File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdbc/odbc to sql server

 
jenny brad
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our JDBC forum.
 
jenny brad
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 333
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 862
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for an open source type 4 driver that doesn't require odbc check out jtds. http://jtds.sourceforge.net/
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic