in reply to Perl connect to Microsoft SQL 2000

Do you advise using the Win32::ODBC module. We created a System DSN for our Microsoft SQL 2000 Server which is located externally on the network. In the examples i have read, they assume that the Server was located locally. This is the code i have been using: use Win32::ODBC; my($db) = new Win32::ODBC("dsn=$dsn_name; uid=$username; pwd=$password") || die "Could not connect to database\n"; $db->Sql("SELECT * FROM Tbl_Job"); while ($db->FetchRow()) { print "Hello World\n"; } Thanks again for your help. Daniel

Replies are listed 'Best First'.
Re: Perl connect to Microsoft SQL 2000
by jZed (Prior) on Jul 01, 2004 at 03:19 UTC
    Do you advise using the Win32::ODBC module.
    If you have some very specific ODBC things you want to accomplish that aren't part of most everyday database interactions, then yes, use Win32::ODBC. Otherwise, use DBI with DBD::ODBC or one of the other DBDs recommended above. It can use either system DSNs or "DSN-less connections". It will be much easier to learn in the long run (more people to give advice), and what you learn about DBI will apply to many other database contexts whereas what you learn about Win32::ODBC only helps you with Win32/ODBC.