aspose file tools*
The moose likes JDBC and the fly likes SQL SERVER Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL SERVER" Watch "SQL SERVER" New topic
Author

SQL SERVER

nitin kumar
Ranch Hand

Joined: May 14, 2002
Posts: 105
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

Joined: Apr 12, 2004
Posts: 7
So Simple . The driver is in ur classpath.
[ May 05, 2004: Message edited by: Vijayanandraj Amaladoss ]
nitin kumar
Ranch Hand

Joined: May 14, 2002
Posts: 105
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

Joined: May 26, 2003
Posts: 31054
    
162

Nitin,
It can go at the end of the url string. For example,
"jdbc:microsoft:sqlserver://111.111.111.111:1433;DatabaseName=name"


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
nitin kumar
Ranch Hand

Joined: May 14, 2002
Posts: 105
Hi jeanne,

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

bye
Nitin
nitin kumar
Ranch Hand

Joined: May 14, 2002
Posts: 105
Hi ,


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

bye
nitin
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31054
    
162

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: SQL SERVER