[unixODBC-support] unixODBC, MySQL & Perl

martin.evans at easysoft.com martin.evans at easysoft.com
Sat Feb 26 12:22:23 GMT 2005


Quoting martin.evans at easysoft.com:

> When do you get the crash? when the script exits? or on the connect? I
> suspect
> the former. Are you running a thread perl? I have seen problems like this
> with
> threaded Perls. You could try adding DontDLClose = 1 to the DSN.

I meant to the driver entry.
 
> Martin
> 
> Quoting Alan Smith <alan at d-sol.co.uk>:
> 
> > Hi,
> > 
> > I'm having trouble getting unixODBC to work with Perl. With isql I can
> > connect 
> > to my database and run SQL queries but with Perl I get a segfault.
> > 
> > odbc.ini=
> > [TestDSN]
> > Description = MySQL ODBC Database
> > Driver = MyODBC
> > Server = localhost
> > Database = test
> > Port = 
> > Socket = 
> > Option = 3
> > Stmt = 
> > 
> > odbcinst.ini=
> > [ODBC]
> > Trace = Yes
> > TraceFile = /tmp/sql.log
> > ForceTrace = Yes
> > Pooling = No
> > [MyODBC]
> > Description = ODBC Driver for MySQL
> > Driver = /usr/lib/unixODBC/libmyodbc3.so
> > Setup = /usr/lib/unixODBC/libodbcmyS.so.1
> > UsageCount = 1
> > CPTimeout = 
> > CPReuse = 
> > Option =
> > 
> > If I run this perl script:
> > #!/usr/bin/perl
> > # Go
> > use DBI();
> > use strict;
> > 
> > my @drivers = DBI->available_drivers;
> > print join(", ", @drivers), "\n";
> > my $d = join("", @drivers);
> > print "DBD::ODBC ";
> > print "not " if ($d !~ /ODBC/);
> > print "installed\n";
> > my @dsns = DBI->data_sources('ODBC');
> > foreach my $d (@dsns) {
> >         print "$d\n";
> > }
> > my $dbh = DBI->connect('DBI:ODBC:TestDSN', 'demo', 'password');
> > $dbh->disconnect if ($dbh);
> > exit (0);
> > 
> > I get the following output:
> > CSV, DBM, ExampleP, File, ODBC, Proxy, Sponge, mysql
> > DBD::ODBC installed
> > DBI:ODBC:TestDSN
> > Segmentation fault
> > 
> > If I deliberately mis-type the user name with dmo instead of demo I get the
> 
> > following output:
> > CSV, DBM, ExampleP, File, ODBC, Proxy, Sponge, mysql
> > DBD::ODBC installed
> > DBI:ODBC:TestDSN
> > DBI connect('TestDSN','dmo',...) failed: [unixODBC][MySQL][ODBC 3.51 
> > Driver]Access denied for user: 'dmo at localhost' (Using password: YES) 
> > (SQL-HY000)(DBD: db_login/SQLConnect err=-1) at ../odbc_test.pl line 21
> > 
> > If instead of using unixODBC I use the mysql driver thus:
> > my $dbh = DBI->connect('DBI:mysql:test', 'demo', 'password');
> > 
> > The script successfully connects to the database.
> > 
> > Can anybody help?
> > 
> > Thanks,
> > 
> > Alan Smith.
> > 
> > 
> > _______________________________________________
> > unixODBC-support mailing list
> > unixODBC-support at easysoft.com
> > http://mail.easysoft.com/mailman/listinfo/unixodbc-support
> > 
> > 
> > 
> 
> 
> 
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support at easysoft.com
> http://mail.easysoft.com/mailman/listinfo/unixodbc-support
> 
> 
> 






More information about the unixODBC-support mailing list