davies has asked for the wisdom of the Perl Monks concerning the following question:
However, in the various manual pages I have read, ISTR reading that connecting via ODBC is deprecated. I understand that TIMTOWTDI, so if I should give up and use whatever works, please let me know. Attempting to to it the BEST way, I have tried several variants on the following code:use strict; use DBI; use warnings; use diagnostics; my $dsn = 'MySQL'; my $user = 'JHD'; my $password = 'JHD'; my $dbh = DBI->connect("DBI:ODBC:$dsn",$user,$password) || die "Got error $DBI::errstr when connecting to $dsn\n" +; exit (0);
use strict; use DBI; use warnings; use diagnostics; my $sqlhost = 'localhost'; my $sqlbase = 'debloat'; my $user = 'JHD'; my $password = 'JHD'; my $dbh = DBI->connect("DBI:mysql:database=$sqlbase;host=$sqlhost", $user, $password, {RaiseError => 1}); exit (0);
C:\Perl\bin>perl -w practice\sqltest.pl Uncaught exception from user code: DBI connect('database=debloat;host=localhost;port=3306', 'JHD',...) failed: Client does not support authentication protocol requested by server; consider upgrading MySQL client at practice\sqltest.pl line 11 DBI::__ANON__('undef', 'undef') called at C:/Perl/site/lib/DBI.pm line 664 DBI::connect('DBI', 'DBI:mysql:database=debloat;host=localhost;port=3306 ', 'JHD', 'JHD', 'HASH(0x15d4f58)') called at practice\sqltest.pl line 11
| Field | Type | Null | Key | Default | Extra |
| Host | varchar(60) | PRI | |||
| User | varchar(16) | PRI | |||
| Password | varchar(41) | ||||
| Select_priv | enum('N','Y') | N |
| 1. | ActivePerl-DocTools | 0.04 | Perl extension for Documentation TOC Gene~ |
| 2. | ActiveState-Relocat~ | 0.03 | Relocate a Perl installation |
| 3. | ActiveState-Rx | 0.60 | Regular Expression Debugger |
| 4. | Archive-Tar | 1.07 | Manipulates TAR archives | 5. | Compress-Zlib | 1.22 | Interface to zlib compression library |
| 6. | Data-Dump | 1.01 | Pretty printing of data structures |
| 7. | DBD-mysql | 2.9003 | MySQL driver for the Perl5 Database Inter~ |
| 8. | DBD-ODBC | 1.11 | ODBC Driver for DBI |
| 9. | DBI | 1.47 | Database independent interface for Perl |
| 10. | Digest-HMAC | 1.01 | Keyed-Hashing for Message Authentication |
| 11. | Digest-MD2 | 2.03 | Perl interface to the MD2 Algorithm |
| 12. | Digest-MD4 | 1.1 | Perl interface to the MD4 Algorithm |
| 13. | Digest-SHA1 | 2.06 | Perl interface to the SHA-1 Algorithm |
| 14. | File-CounterFile | 1.01 | Persistent counter class |
| 15. | Font-AFM | 1.18 | Interface to Adobe Font Metrics files |
| 16. | HTML-Parser | 3.34 | HTML parser class |
| 17. | HTML-Tagset | 3.03 | Data tables useful in parsing HTML |
| 18. | HTML-Tree | 3.18 | build and scan parse-trees of HTML |
| 19. | IO-Zlib | 1.01 | IO:: style interface to Compress::Zlib |
| 20. | libwin32 | 0.21 | A collection of extensions that aims to p~ |
| 21. | libwww-perl | 5.75 | Library for WWW access in Perl |
| 22. | MD5 | 2.02 | Perl interface to the MD5 Algorithm (obso~ |
| 23. | PPM3 | 3.1 | Perl Package Manager: locate, install, up~ |
| 24. | SOAP-Lite | 0.55 | Library for Simple Object Access Protocol~ |
| 25. | Tk | 800.024 | A Graphical User Interface Toolkit |
| 26. | URI | 1.27 | Uniform Resource Identifiers (absolute an~ |
| 27. | Win32-AuthenticateU~ | 0.02 | Win32 User authentication for domains |
| 28. | Win32-OLE | 0.1403 | OLE Automation extensions |
| 29. | XML-Parser | 2.34 | A Perl module for parsing XML documents |
| 30. | XML-Simple | 2.09 | Easy API to read/write XML (esp config fi~ |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Connecting to MySQL
by jbrugger (Parson) on Apr 14, 2005 at 12:55 UTC | |
|
Re: Connecting to MySQL
by polettix (Vicar) on Apr 14, 2005 at 12:59 UTC | |
|
Re: Connecting to MySQL
by RazorbladeBidet (Friar) on Apr 14, 2005 at 12:57 UTC | |
by davies (Monsignor) on Apr 15, 2005 at 13:29 UTC | |
|
Re: Connecting to MySQL
by jpeg (Chaplain) on Apr 14, 2005 at 14:25 UTC | |
|
Re: Connecting to MySQL
by nmcfarl (Pilgrim) on Apr 14, 2005 at 15:21 UTC | |
|
Re: Connecting to MySQL
by davies (Monsignor) on Apr 15, 2005 at 08:36 UTC | |
|
Re: Connecting to MySQL Redux
by davies (Monsignor) on Apr 19, 2005 at 13:42 UTC |