I've installed the driver JDBC for Microsoft SQL Server 2000 and set the path on autoexec.bat like this :
SET CLASSPATH=.;C:\Program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;C:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar
PATH=C:\j2sdk142\BIN;%PATH%
SET CLASSPATH =.\;%CLASSPATH%
This is my java code :
import java.sql.*;
class Koneksi
{
public static void main(String[] args)
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con=DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.1:1433;DatabaseName=Northwind,user=user,password=password");
con.close();
System.out.println("Connection Success..!!!");
System.exit(0);
}
catch(ClassNotFoundException eclass)
{
System.out.println("Driver Not Found !");
}
catch(SQLException esql)
{
System.out.println(esql.getMessage());
}
}
}
I run the compiled java and got this result :
" Driver Not Found ! "
Why it couldn't find the driver? is there something wrong with the Set Classpath command?
SET CLASSPATH=.;C:\Program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;C:\program files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar
PATH=C:\j2sdk142\BIN;%PATH%
SET CLASSPATH =.\;%CLASSPATH%
This is my java code :
import java.sql.*;
class Koneksi
{
public static void main(String[] args)
{
try
{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con=DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.0.1:1433;DatabaseName=Northwind,user=user,password=password");
con.close();
System.out.println("Connection Success..!!!");
System.exit(0);
}
catch(ClassNotFoundException eclass)
{
System.out.println("Driver Not Found !");
}
catch(SQLException esql)
{
System.out.println(esql.getMessage());
}
}
}
I run the compiled java and got this result :
" Driver Not Found ! "
Why it couldn't find the driver? is there something wrong with the Set Classpath command?