Originally posted by ravitadakamalla:
Hi,
I am using Microsoft JDBC Driver for connecting to SQL Server database. My connection always goes to Default database set in the SQL Server for the current user ('sa'). Can anyone please suggest me how to use a DSN with Microsoft JDBC Driver for connecting to SQL Server.
Thanks
RaviTadakamalla
hi,
basically it depends on the which Driver u are trying to use
and which dsn u r tyin to connect!
double check++;
use Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
and create a dsn using the default MS ODBC
name it for example as Northwind;
then ur code is like
DriverManager.getConnection("jdbc:odbc:Northwind", user, password ");
hope this works!!!
watch my new movie K3G
Thanx
------------------