This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc/odbc to sql server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jdbc/odbc to sql server" Watch "jdbc/odbc to sql server" New topic
Author

jdbc/odbc to sql server

jenny brad
Ranch Hand

Joined: Jun 24, 2006
Posts: 30
The enviornment is all windows and we have to use MS sql server for db. where can I find the code for the connection using jdbc/odbc driver? is this a good choice?

anyone having experience, please shade some lights. thanks.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Moving to our JDBC forum.


[Jess in Action][AskingGoodQuestions]
jenny brad
Ranch Hand

Joined: Jun 24, 2006
Posts: 30
I downloaded sql server JDBC driver and put the following code to test:

DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://Host:1433","UID","PWD");

but it says "com.microsoft can't be resolved to a type". what is the problem?
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
The instructions for connecting are slightly different, depending on whether you are using SQL Server 2000, or SQL Server 2005

Here are some resources that explain it all.

SQL Server 2000
http://www.microsoft.com/downloads/details.aspx?familyid=9F1874B6-F8E1-4BD6-947C-0FC5BF05BF71&displaylang=en
http://www.akadia.com/services/sqlsrv_jdbc.html
http://support.microsoft.com/default.aspx?scid=kb;en-us;313100

SQL Server 2005
http://www.microsoft.com/downloads/details.aspx?familyid=E22BC83B-32FF-4474-A44A-22B6AE2C4E17&displaylang=en
http://msdn.microsoft.com/data/ref/jdbc/
http://msdn2.microsoft.com/en-us/library/ms378672.aspx

You can also use the jTDS driver with both. Many people seem to prefer it with SQL Server 2000. The 2005 driver is much improved and I don't know a consensus that jTDS is or is not better than the 2005 driver.
http://jtds.sourceforge.net/
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 860
for an open source type 4 driver that doesn't require odbc check out jtds. http://jtds.sourceforge.net/


http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jdbc/odbc to sql server
 
Similar Threads
need help
Where should IP address in Connection?
EJB to RJD Mapping
Sun jdbc odbc bridge error
Connecting to SQL Server from NetBeans