当前位置: 技术问答>java相关
jdbc driver 问题!
来源: 互联网 发布时间:2015-11-02
本文导语: 我在运行以下代码时报异常, 请高手给我看看 void jButton1_actionPerformed(ActionEvent e) { try { Class.forName("weblogic.jdbc.mssqlserver4.Driver"); Connection con = DriverManager.getConnectio...
我在运行以下代码时报异常, 请高手给我看看
void jButton1_actionPerformed(ActionEvent e) {
try
{
Class.forName("weblogic.jdbc.mssqlserver4.Driver");
Connection con = DriverManager.getConnection("jdbc:weblogic:mssqlserver4:northwind@localhost","sa","");//此处根据你的SQLServer帐户而定。
Statement st = con.createStatement();
ResultSet res = st.executeQuery("select * from employees");
String line = "";
while (res.next())
line = line + res.getString("title")+"n";
jTextArea1.setText(line);
con.close();
}
catch (Exception ex)
{
jTextArea1.setText("error : "+ex.getMessage());
}
}
异常:
error : java.sql.SQLException: $$$$$$$$$$$$$$$$ License Exception $$$$$$$$$$$$$$$$
jDriver/MSSQLServer4: license signature validation error!
$$$$$$$$$$$$$$$$ License Exception $$$$$$$$$$$$$$$$
void jButton1_actionPerformed(ActionEvent e) {
try
{
Class.forName("weblogic.jdbc.mssqlserver4.Driver");
Connection con = DriverManager.getConnection("jdbc:weblogic:mssqlserver4:northwind@localhost","sa","");//此处根据你的SQLServer帐户而定。
Statement st = con.createStatement();
ResultSet res = st.executeQuery("select * from employees");
String line = "";
while (res.next())
line = line + res.getString("title")+"n";
jTextArea1.setText(line);
con.close();
}
catch (Exception ex)
{
jTextArea1.setText("error : "+ex.getMessage());
}
}
异常:
error : java.sql.SQLException: $$$$$$$$$$$$$$$$ License Exception $$$$$$$$$$$$$$$$
jDriver/MSSQLServer4: license signature validation error!
$$$$$$$$$$$$$$$$ License Exception $$$$$$$$$$$$$$$$
|
换一个jdbc驱动,好多地方都有下载的,最好用微软自己的,速度会快些。
|
http://java.sun.com/products/jdbc/
|
License Exception --------过了试用期了
|
首先确定程序能够找到:%WL_HOME%LIBweblogic.jar文件;
其次修改为:Connection con = DriverManager.getConnection("jdbc:weblogic:mssqlserver4:northwind@localhost:1433","sa","");
最后:Good Luck!
其次修改为:Connection con = DriverManager.getConnection("jdbc:weblogic:mssqlserver4:northwind@localhost:1433","sa","");
最后:Good Luck!