当前位置: 技术问答>java相关
高分的简单问题,在线散分
来源: 互联网 发布时间:2015-08-11
本文导语: 新到一家公司,装完系统进行JBUILDER7连接ORACLE8I测试,代码如下: package datatest; import java.sql.*; public class ConnectionTest { static String sql = "select * from scott.emp"; public static void main(String[] args) { try{ ...
新到一家公司,装完系统进行JBUILDER7连接ORACLE8I测试,代码如下:
package datatest;
import java.sql.*;
public class ConnectionTest {
static String sql = "select * from scott.emp";
public static void main(String[] args) {
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@eu:1521:xkyy");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery(sql);
while(rset.next()){
System.out.println(rset.getString(2));
}
}
catch(SQLException e){
System.out.println(e.getMessage());
}
}
}
我已设定CLASSPATH指向CLASSES12.ZIP并且在工程属性里引入了CLASSES12.ZIP。
但不管是在JBUILDER7里还是把代码拷出来在外面用JDK运行,都出现一种错误:
C:JBuilder7jdk1.3.1binjavaw -classpath "D:jbprojectDataTestclasses;D:OracleOra81jdbclibclasses12.zip;C:JBuilder7jdk1.3.1demojfcJava2DJava2Demo.jar;C:JBuilder7jdk1.3.1jrelibi18n.jar;C:JBuilder7jdk1.3.1jrelibjaws.jar;C:JBuilder7jdk1.3.1jrelibrt.jar;C:JBuilder7jdk1.3.1jrelibsunrsasign.jar;C:JBuilder7jdk1.3.1libdt.jar;C:JBuilder7jdk1.3.1libhtmlconverter.jar;C:JBuilder7jdk1.3.1libtools.jar" datatest.ConnectionTest
Io 异常: Connection reset by peer: JVM_recv in socket input stream read
请问各位大虾如何解决?
package datatest;
import java.sql.*;
public class ConnectionTest {
static String sql = "select * from scott.emp";
public static void main(String[] args) {
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@eu:1521:xkyy");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery(sql);
while(rset.next()){
System.out.println(rset.getString(2));
}
}
catch(SQLException e){
System.out.println(e.getMessage());
}
}
}
我已设定CLASSPATH指向CLASSES12.ZIP并且在工程属性里引入了CLASSES12.ZIP。
但不管是在JBUILDER7里还是把代码拷出来在外面用JDK运行,都出现一种错误:
C:JBuilder7jdk1.3.1binjavaw -classpath "D:jbprojectDataTestclasses;D:OracleOra81jdbclibclasses12.zip;C:JBuilder7jdk1.3.1demojfcJava2DJava2Demo.jar;C:JBuilder7jdk1.3.1jrelibi18n.jar;C:JBuilder7jdk1.3.1jrelibjaws.jar;C:JBuilder7jdk1.3.1jrelibrt.jar;C:JBuilder7jdk1.3.1jrelibsunrsasign.jar;C:JBuilder7jdk1.3.1libdt.jar;C:JBuilder7jdk1.3.1libhtmlconverter.jar;C:JBuilder7jdk1.3.1libtools.jar" datatest.ConnectionTest
Io 异常: Connection reset by peer: JVM_recv in socket input stream read
请问各位大虾如何解决?
|
肯定是你装数据库时出现了问题,以至于数据库本身不稳定,老兄啊,还是用正版的好啊。