-
java to MS SQL
i'm new to this thing. sorry for bothers but i want to know what did i miss? i have this code throwing an exception of com.microsoft.jdbc.sqlserver.SQLServerDriver
PHP Code:
import java.sql.*;
public class JdbcExample3{
public static void main(String args[]){
Connection conn=null;
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
conn=DriverManager.getConnection(
"jdbc:microsoft:sqlserver:///northwind");
if(!conn.isClosed())
System.out.println("sucessfully connected to sql server...");
}
catch(Exception e){
System.err.println("Exception: "+e.getMessage());
}
finally{
try{
if(conn!=null) conn.close();
}
catch(SQLException e){}
}
}
}
i installed the j2sdk1.4.0, microsoft sql server 2000 for jdbc driver and the ms sql 2000.
-
-
yo, corned... this is the output, an exception...
Exception: com.microsoft.jdbc.sqlserver.SQLServerDriver
thanx for the reply...
-
Can you give the output of e.printStackTrace() ?
-
Code:
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:130)
at JdbcExample3.main(JdbcExample3.java:7)
-
The JDBC driver is not installed properly and not found by the Java runtime.
-
i'll just try to download the driver again or maybe find another one... thanx corned. just have to search more. thanx so much... :)