The SQL Server 2000 Driver for JDBC needs to be defined in your CLASSPATH variable.

For Windows

CLASSPATH=.;c:\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;
c:\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;
c:\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar

java.sql package provides classes to use the database.

Example below connect to SQL server 2000 with Microsoft SQL Server 2000 driver for JDBC.

 import java.sql.*;

public class getConnection 
{
        public static void main(String[] args) 
        {
                DB db = new DB();
                Connection conn=db.dbConnect(
          "jdbc:microsoft:sqlserver://localhost:1433;User=sa;Password=");
        }

}

class DB
{
        public DB() {}

        public Connection dbConnect(String db_connect_string)
        {
                try
                {
                        Class.forName(
                          "com.microsoft.jdbc.sqlserver.SQLServerDriver");
                          
                        Connection conn = 
                          DriverManager.getConnection(db_connect_string);
                          
                        System.out.println("connected");
                        return conn;
                        
                }
                catch (Exception e)
                {
                        e.printStackTrace();
                        return null;
                }
        }
};