Well, all I can say for you out there who procrastinate on submitting summaries: don't. After I sent my sorry summary confessing that I had to use a Windows machine to access my badge system, Michael Grice e-mailed me to say that he had successfully made this work. Thanks to his patience, and some backing and forthing, I achieved the exact combination of configuration flags, compilation options and module versions that allowed me to access a SQL Server from my Sun. Here's the solution: 1) Download FreeTDS 0.53 from www.freetds.org and build with the following configure options: # ./configure --with-tdsver=7.0 --with-prefix=/usr/local/freetds # make # make install The TDS version is set to 7.0, while in the code snippet listed below, 4.2 is used. It works. Don't ask. When the installation completes, create a new entry in /usr/local/freetds/interfaces to define the address of your SQL Server. For instance: ntws query tcp ether 10.175.0.9 1433 master tcp tds7.0 10.175.0.9 1433 "ntws" is the name you will refer to the SQL Server as, when you invoke DBI->connect in the Perl code. 2) Download the DBD-Sybase-0.91 Perl module (versions above 0.91 will not work), and configure as follows: edit CONFIG to set the following values: SYBASE=/usr/local/freetds EXTRA_LIBS=-ltds Then set your environment variables like this: export SYBASE=/usr/local/freetds export LD_LIBRARY_PATH=$SYBASE/lib:$LD_LIBRARY_PATH (or if the LD_LIBRARY_PATH variable is empty, set it to LD_LIBRARY_PATH=$SYBASE/lib:/usr/lib:/lib:/usr/local/lib) It is important to place the $SYBASE/lib pathname *first* in LD_LIBRARY_PATH. Also, edit the PWD file with the hostname of your SQL Server, and the appropriate username and password to bind to it. # /path/to/perl Makefile.PL # make # make test # make install Expect some of the tests to fail during the "make test". I only had 58% successful, Michael reported only 22% successful, but he was using FreeTDS 0.51. 3) Access the database with this code segment: #!/path/to/perl use DBI; BEGIN { $ENV{SYBASE} = '/usr/local/freetds'; $ENV{TDSVER} = '42'; } $data_source = "DBI:Sybase:ntws"; $database = "mydata"; $username = "snafu"; $password = "foobar"; $dbh = DBI->connect($data_source, $username, $password) || die; $sql_statement = "SELECT table_name " . "FROM $database.information_schema.tables"; $sth = $dbh->prepare($sql_statement) || die; $sth->execute || die; while (($table) = $sth->fetchrow_array) { print "Database $database contains table $table\n"; } $sth->finish; $dbh->disconnect; Voil`! Thanks Michael! (Thank you to Ed Rolison too, who also sent in his two cents after I posted my summary.) Cheers! +===========================================================+ | Fabrice "Script It!" Guerini Blue Martini Software, Inc. | | Senior Operations Engineer 2600 Campus Drive | | Tel: (650) 356-7576 San Mateo, CA 94403-2522 | | Fax: (650) 356-4001 www.bluemartini.com | +===========================================================+ _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Tue Mar 5 09:23:10 2002
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:36 EST