Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dsn less connections

 
Bhupendra Malviya
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to jdbc programming. Can you please tell me how to make dsn less connection to major databases like SQL Server, Oracle etc.
Thanking u all in advance
Bhupendra
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am also trying to connect sql server with java application.i got somthing from net but is donot work in muy code,i think it need some kind of driver.


Properties p=new Properties();
p.put("test","DRIVER={SQL Server};ServerName=sw8;UID=wh1;PWD=wh1");
String sConnect =new String("jdbc:sw8://192.168.0.11/,");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(sConnect,p);
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34837
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gowher,
Welcome to JavaRanch!

Yes, you need a driver. It comes with your database. As an alternative, you can download the JDBC driver from Microsoft.

Also, note that the original question is a year and a half old. It's ok to start a new thread in the future.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic