Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Connecting JAVA with SQL Server 2000

843859Oct 17 2005 — edited Mar 21 2006
Hai,...

I want to connect JAVA with SQL server 2000. But i don't know how to do it. I use jdk 1.4. Some people say that i have to Download SQL server for JDBC, so i download it from microsoft website. And then i run the following code:


import java.sql.*;

class testing
{
public static void main (String args [])
{

Connection con;


try{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

} catch (java.lang.ClassNotFoundException e){

System.err.println("ClassNotFoundException");
System.err.println(e.getMessage());
}


try{

con = DriverManager.getConnection("jdbc:microsoft:sqlserver://febry:1433","febry","febry");

}catch (SQLException ex){

System.err.println("SQL Exception :" + ex.getMessage());
}


}

}



I get an error ----> No Suitable Driver.

Other people use :
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
I try that one too, but it doesn't work.
What is the different between the one that i use with the "com.microsoft....." ?

Can someone please tell me how to do it?

Thank you,
Billy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 18 2006
Added on Oct 17 2005
15 comments
343 views