You need to setup a DSN. If you are on Windows platforms, then start with a
System DSN if possible (instead of a User DSN or File DSN). Create the DSN
to "point" to the database. Example:
Create A DSN named SQLSERVER1 which connects to the sql server database and
Create a DSN named SYBASE1 which connects to the sybase database
Then, using DBI, you can:
$dbh1 = DBI->connect("dbi:ODBC:SQLSERVER1", "user", "password", {
RaiseError => 1 });
and/or
$dbh2 = DBI->connect("dbi:ODBC:SYBASE1", "user", "password", { RaiseError
=> 1 });
Regards,
Jeff
> Hi all..
>
> I have to use ODBC to connect to the sql server (db_server) also using the
> same ODBC i have to connect to sybase database also. Iam not able to
> understand the driver concept. Will the ODBC driver be able to connect to
> both the server.
>
> I have DBIODBC.pm file. So i guess while using DBI in my perl,
> this file is
> used.
>
> so, what connect string i can use to connect to the databases.
> Can i use..
>
> $dbh = DBI->connect("DBI:ODBC:server_name","sa","");
>
> If possible get me a sample code to read the names in the sysusers table
> from both the databases (sybase & SQL).
>
> thanks
> Prassana
>
>