Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Microsoft JDBC Driver Connection Problem  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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("jdbcdbc:Northwind", user, password ");
hope this works!!!
watch my new movie K3G
Thanx


------------------
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!