I am trying to connect SQL SERVER VIA JDCB. Following is something I tried and will appreciate any help what I am doing wrong
Here's what I did, I tried several variations, but I keep getting this error:
Exception in thread "main" java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect. Invalid URL
I tried:
Driver d = (Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://133.5.144.155/:1433/IE;selectMethod=cursor", "jdbc123", "test1456"); replacing ://133.5.144.155 with \\IP
my classpath is :
voyager->whseuser: echo $CLASSPATH
/apps/twhse/scripts/jen:/apps/twhse/scripts/jen/mssqlserver/lib/msutil.jar:/apps/twhse/scripts/jen/mssqlserver/lib/mssqlserver.jar:/apps/twhse/scripts/jen/mssqlserver/lib/msbase.jar
and it's not giving me a classpath error, so I think my classpath is right.
import java.sql.*;
//import oracle.jdbc.*;
public class HelloWorldApp {
public static void main(String[] args) throws Exception {
System.out.println("Hello World!"); // Display the string.
Driver d = (Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://133.5.144.155/:1433/IE;selectMeth
od=cursor", "jdbc123", "test456");
}
}
I have never tried this on a sqlserver before, only in oracle.
will appreciate any response at
thanks
sam