ClassNotFound - In applet for com.microsoft.jdbc.sqlserver.SQLServerDriver
I developed this in netbeans 5.5.1, JDK 1.6
I have added the msbase, mssqlserver and msutil jar files to my libraries in netbeans. I also tried setting my class path manually in two ways
a) SET CLASSPATH=..........
b) going into system properties, environment variables etc
Now.. my applet runs in the applet viewer of netbeans just fine, but when I run it in my webpage i get the classnotfound exception.
I am running IIS (whichever version ships with xp pro).
I also tried compiling with javac -cp (classpath here) but i still get the same results..
I've tried moving the jar files into the scope of the webapp itself , and it didn't make a difference
any help would be greatly appreciated! thanks
import java.sql.*;
import java.applet.*;
import java.awt.Graphics;
publicclass connectextends Applet{
publicvoid paint(Graphics g)
{
String s = connectsql();
g.drawString(s, 5, 15);
}
public String connectsql()
{
String user="username";
String pass="password";
String url ="jdbc:microsoft:sqlserver://sql_server_name:1433;databaseName=database_name;selectMethod=cursor;";
String ret ="";
java.sql.Connection connection =null;
try
{
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
connection = java.sql.DriverManager.getConnection(url, user, pass);
if (connection !=null)
{
ret ="connected";
connection.close();
connection =null;
}
else
{
ret ="failed to connect";
}
}catch(ClassNotFoundException cnfe){
ret = cnfe.toString();
}
}
catch (Exception e)
{
ret ="caught new driver exception: " + e.toString();
}
return ret;
}
}

