I'm new to Java and have been browsing all day to figure out my problem but no luck. Hope someone here can help me.
Here are my settings:
Windows XP Pro SP2, SQL Server 2000 SP3, J2 SDK 1.4.2, Netbeans 4.0 (hope that's enough)
This is the code I found on one of the threads to test the connection:
import java.sql.*;
/**
* Microsoft SQL Server JDBC test program
*/
public class Test {
public Test() throws Exception {
// Get connection
DriverManager.registerDriver(new
com.microsoft.jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection(
"jdbc:microsoft:sqlserver://sqlserver:1433","sa","password");
if (connection != null) {
System.out.println();
System.out.println("Successfully connected");
System.out.println();
// Meta data
DatabaseMetaData meta = connection.getMetaData();
System.out.println("\nDriver Information");
System.out.println("Driver Name: "
+ meta.getDriverName());
System.out.println("Driver Version: "
+ meta.getDriverVersion());
System.out.println("\nDatabase Information ");
System.out.println("Database Name: "
+ meta.getDatabaseProductName());
System.out.println("Database Version: "+
meta.getDatabaseProductVersion());
}
} // Test
public static void main (String args[]) throws Exception {
Test test = new Test();
}
}
I keep getting the error - package com.microsoft.jdbc.sqlserver does not exist. I downloaded and installed it (version 2.2 if i remember correctly). I checked the path in the command prompt and it includes the all 3 jar files (ie C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar).
I've seen threads and tutorials that say I have set the CLASSPATH and I did by entering SET CLASSPATH=.;PATH TO THE JAR FILES
I don't know what else to do. Someone please help this noob out.
Thanks in advance