Why not try DBD::Sybase if you have the db libraries for M$SQL on the
machine where your perl app is running?  DBD::Sybase will run with both
Sybase and M$SQL.  Sorry that doesn't really answer your question about
ODBC, but if you aren't tied to ODBC, the other driver should work for
you.

Good Luck
--Curt

On Thu, 5 Apr 2001, David J. Marcus wrote:

> Hi
> 
> I'm running on a Win2K w/SP1 system.
> 
> I've searched hi/lo for a clear example on how to connect and use ODBC to
> get to an MS/SQL Server database.
> 
> I'm trying to connect to a SQL Server system on my local network (resides on
> \\SQLSRVR).
> 
> I've defined an ODBC data source name using the Control Panel ->
> Administrative Tools -> Data Sources (ODBC) -> System DSN
> 
> I specified under the Name column: TestDB
> the Driver is: SQL Server
> 
> In the configuration of the entry the Name shows up correctly as TestDB and
> the Server to connect to shows up as SQLSRVR.
> 
> When setting up the entry, the testing of the connection indicated that it
> was successful (able to interact with the DB).
> 
> When I list the available ODBC drivers (using example in Programming the
> Perl DBI book), it shows:
> 
> Driver: ODBC
>         Data Source is DBI:ODBC:Visual FoxPro Database
>         . . .
>         Data Source is DBI:ODBC:TestDB
>         . . .
> 
> So I know that the ODBC connection is there.
> 
> In my test program I:
>         my $conn = DBI->connect( "dbi:ODBC:DSN=TestDB", 'sa', ''') or die...
>         my $sth = $conn->prepare( " CREATE TABLE ..."} or die...
>         $sth->execute or die...
> 
> The connect fails with the following error message:
>     DBI->connect(DSN=TestDB) failed: [Microsoft][ODBC Driver Manager] Data
> source name not found and no default driver specified (SQL-IM002)(DBD:
> db_login/SQLConnect err=-1)
> 
> I am suspecting that I am not specifying the DSN properly.
> 
> I would love to see a simple example with actual values in the connect
> statement corresponding to an ODBC connection to an MS/SQL Server database.
> 
> -TIA
> David
> 
> 
> 
> 
> 

Reply via email to