我又写了一个测试程序,还是报错,程序如下
import java.sql.*;
public class Test {
public static void main(String agrs[]){
String driver="com.informix.jdbc.IfxDriver";
String url="jdbc:informix-sqli://10.1.1.250:6688/misdb";
String user="mis";
String password="mis";
try{
Class.forName(driver);
}
catch(Exception E) {
System.out.println("无法加载驱动程序"+driver);
E.printStackTrace();
}
try
{
Connection con=DriverManager.getConnection(url,user,password);
if(!con.isClosed())
System.out.println("打开数据库成功");
con.close();
}
catch(SQLException SE)
{
System.out.println("打开数据库失败");
SE.printStackTrace();
} }
}错误如下:
打开数据库失败
java.sql.SQLException: This release of JDBC requires to be run with JDK 1.2+.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:240)
at com.informix.jdbc.IfxDriver.checkURL(IfxDriver.java:425)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:160)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at Test.main(test.java:28)
import java.sql.*;
public class Test {
public static void main(String agrs[]){
String driver="com.informix.jdbc.IfxDriver";
String url="jdbc:informix-sqli://10.1.1.250:6688/misdb";
String user="mis";
String password="mis";
try{
Class.forName(driver);
}
catch(Exception E) {
System.out.println("无法加载驱动程序"+driver);
E.printStackTrace();
}
try
{
Connection con=DriverManager.getConnection(url,user,password);
if(!con.isClosed())
System.out.println("打开数据库成功");
con.close();
}
catch(SQLException SE)
{
System.out.println("打开数据库失败");
SE.printStackTrace();
} }
}错误如下:
打开数据库失败
java.sql.SQLException: This release of JDBC requires to be run with JDK 1.2+.
at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:240)
at com.informix.jdbc.IfxDriver.checkURL(IfxDriver.java:425)
at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:160)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at Test.main(test.java:28)
看看说明
你的jdbc版本是1.2以上的,——> 你的jdbc版本需要jdk1.2以上的,
所以不能用