Here is an example of connectivity ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // First load the driver classes String driverName = "weblogic.jdbc.mssqlserver4.Driver"; try 

Class.forName(driverName).newInstance(); 
System.out.println("\n loadDrivers: "+ 
"SQL Server 7 Type 4 driver classes: "+ 
" successfuly loaded \n"); 

catch(java.lang.IllegalAccessException e) 

System.err.print("loadDrivers: "+ 
"Illegal acess exception caught: "); 
System.err.println(e.getMessage()); 
} catch(java.lang.InstantiationException e) 

System.err.print("loadDrivers: "+ 
"Illegal acess exception caught: "); 
System.err.println(e.getMessage()); } 
catch(java.lang.ClassNotFoundException e) 

System.err.print("loadDrivers: "+ 
"class not found caughtfor driver: \n" ); 
System.err.println(e.getMessage()); } 
} // Connect to datbase 
/* Assuming your SQL server 7 database name is demoSQL7 
* located on the Server DEMOSERVER with access info 
* User = "avijit" and Password = "dutta" 
****************************************************/ Properties dbProp = new Properties(); 
dbProps.put("user", "avijit"); 
dbProps.put("password", "dutta") ; String hostName = "DEMOSERVER"; 
String databaseName = "demoSQL7"; String databaseURL = "jdbc:weblogic:mssqlserver4:"+ 
database+"@"+hostName+":1433"; Connection con = null; try 
{ con = DriverManager.getConnection(DBurl, dbProps); System.out.println(" ConnectToDB: Successful " + 
" connection to database: "+database); } 
catch (SQLException ex) 

System.err.println(" ConnectToDB:***** Failed "+ 
connection to database: "+database); 
System.err.println(" ConnectToDB:setConnection: "+ 
" Exception message "+ex.getMessage()); 
con = null; 

} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 

解决方案 »

  1.   

     驱动在哪儿下,applet有能力访问吗?
      

  2.   

    请问各位  "weblogic.jdbc.mssqlserver4.Driver" 出现 class not found应怎么样设置 classpath 或其它我已安装了 weblogic
      

  3.   

    先在tools/configure libraries上添加驱动的包
    然后在工程中使用这个包
    在tools/enterprise setup里的database drivers选项卡中加入这个包。
    在jdbc explorer中加入这个驱动程序的驱动名
    就可以使用这个驱动了。
      

  4.   

    请问
    "weblogic.jdbc.mssqlserver4.Driver" 这个驱动放在 Weblogic 的哪个地方???
      

  5.   

    %WL_Home%\lib\webligic.jar 中,
    只要在classpath中加入此.jar 即可,