Classpath 如何在Jdeveloper中包含连接到SQLServer2000数据库的驱动程序类和/或类路径?

Classpath 如何在Jdeveloper中包含连接到SQLServer2000数据库的驱动程序类和/或类路径?,classpath,sql-server-2000,jdeveloper,Classpath,Sql Server 2000,Jdeveloper,我想连接到Jdeveloper 11g中的数据库,但我的SQL Server 2000驱动程序似乎有问题。我已经下载了相应的驱动程序(Sqljdbc4.jar),但我不知道如何在代码中包含或使用它 import java.sql.*; class TestConnection { public static void main (String[] args) { try { // Step 1: Load the JDBC ODBC driver Class.forN

我想连接到Jdeveloper 11g中的数据库,但我的SQL Server 2000驱动程序似乎有问题。我已经下载了相应的驱动程序(Sqljdbc4.jar),但我不知道如何在代码中包含或使用它

import java.sql.*;

class TestConnection
{
  public static void main (String[] args)
{ 
    try
{ 
  // Step 1: Load the JDBC ODBC driver 
  Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

  // Step 2: Establish the connection to the database 
    String url = "jdbc:sqlserver://10.1.73.180\\SQL2000;" +
       "databaseName=reportgen;user=sa;password=*****;";
  Connection conn = DriverManager.getConnection(url);
  System.out.println("Connected.");
}
catch (Exception e)
{ 
  System.err.println("Got an exception! "); 
  System.err.println(e.getMessage()); 
} 
} 
}
这显示了当我尝试运行TestConnection.java类时:

Got an exception!  
com.microsoft.sqlserver.jdbc.SQLServerDriver
Process exited with exit code 0.

项目属性->库和类路径->添加JAR。 您可能还需要将其添加到嵌入式WebLogic实例中。 您还可以使用工具->管理库来添加库,然后将该库添加到项目中