Cannot connect to a Microsoft SQL Server using MS SQL JDBC Driver 1.1
Hello!
I downloaded the SQL JDBC driver 1.1 from Microsoft and got a file named sqljdbc.jar. This file has to be put in the Java classpath for java to be able to use it to connect to a MSSQL database. The problem is that, regardless of how I had put it in autoexec.bat as:
SET CLASSPATH=%CLASSPATH%;.;C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\sqljdbc.jar
or
SET CLASSPATH=%CLASSPATH%;.;"C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\sqljdbc.jar"
or
SET CLASSPATH=%CLASSPATH%;.;C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\"sqljdbc.jar"
or
SET CLASSPATH=C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\sqljdbc.jar
and such variations it did not work. Even after moving the file to a directory not containing empty spaces in its name and rewriting the classpath entry in autoexec.bat it did not work. The error was the typical ClassNotFoundException.
If I modify the environmental system variables in Control Panel/System, applying the same naming variations it still does not work. Even using the command:
java - classpath C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.1\enu\sqljdbc.jar program_name does not work.
I tried also using the NetBeans IDE, which does not see the com.microsoft classes autofilling. If I move the jar file to the ext directory in the java/jre/lib directory, the IDE sees it and autofills com.microsoft fields, but the command-line interpretor cannot find the jar file and the program cannot be run.
This is the connection to database sample java file that I used with little editing (my user name and database name), available from Microsoft at this address: http://support.microsoft.com/kb/313100
This question has been addressed before by another user on this forum, but the user has not been given a satisfactory answer.
Any help would be greatly appreciated. Thank you for at least reading this thread!

