Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL SERVER

 
nitin kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://<Host>:1433",<"UID>","<PWD>");

Im using driver type-4 .Im able to connect to a database in my SQL SERVER but I do not know how can this code locate the driver since I did not mention the database name nor the dsn.Can anyone please tell me how they locate the driver
bye
nitin
 
Vijayanandraj Amaladoss
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So Simple . The driver is in ur classpath.
[ May 05, 2004: Message edited by: Vijayanandraj Amaladoss ]
 
nitin kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry I mean to say the database not the driver.How can it locate to any database

bye
Nitin
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin,
It can go at the end of the url string. For example,
"jdbc:microsoft:sqlserver://111.111.111.111:1433;DatabaseName=name"
 
nitin kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi jeanne,

Thanks for your reply.My problem is solved by your help

bye
Nitin
 
nitin kumar
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,


Can anyone tell the difference between obtaining connection through
DriverManager and through DataSource.

bye
nitin
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34422
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitin,
If you use driver manager, you need to manage the connection all by yourself. If you use datasource, the server can help you by doing things like connection pooling.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic