I need to access MySQL from perl.
Can I connect using the odbc driver?
If so, how do I do that?
I just can't seem to get the connection string right!
On windows, where DBD:MySQL is available, this is how I connected:
DBI->connect("DBI:mysql:$database",
$user, $password, {RaiseError => 1});
This is what I've tried:
DBI->connect("DBI:ODBC:$database", $user, $password, {RaiseError => 1});'
This results in the following error:
DBI connect('database','username',...) failed: [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded (SQL-IM002) at -e line 1
This is a standard connection on a local machine -- that is, both the perl app and the MySQL server are on the same machine.
I'd like to use odbc because DBD:mysql doesn't build for ActiveState perl on Mac OS X, and it's much easier for us when we stick with packages that can be obtained through ppm.