日期:2014-05-20  浏览次数:20649 次

JDBC连接oracle程序错误
小弟最近写了一个jdbc连接oracle的程序,在myeclipse里一执行就出现下面的错误。跪求大侠帮忙,下面是小弟的代码和错误界面;
package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class ConnectionJDBC_01 {
public static void main(String[]args){
String driver="oracle.jdbc.driver.OracleDriver";
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String username="hrsoft";
String password="hrsoft";
try{
Class.forName(driver).newInstance();

Connection conn=DriverManager.getConnection(url,username,password);
Statement sta=conn.createStatement();
String sql="select * from students where id=1";
ResultSet re=sta.executeQuery(sql);
while(re.next()){
System.out.println(re.getInt(1));
System.out.println(re.getString(2));
}
re.close();
sta.close();
conn.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
下面是出现错误的信息,
#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (exceptions.cpp:367), pid=224, tid=4368
# Error: ExceptionMark destructor expects no pending exceptions
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b23 mixed mode, sharing windows-x86)
# An error report file with more information is saved as:
# E:\Documents and Settings\Administrator\Workspaces\MyEclipse 8.5\HRsoft_1_0.1\hs_err_pid224.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#


------解决方案--------------------
这个不是程序问题,是你的IDE有问题。谢谢
------解决方案--------------------
工作区不要放桌面吧
------解决方案--------------------
java 运行时的错误,,,代码没有问题。
------解决方案--------------------
Internal Error (exceptions.cpp:367), pid=224, tid=4368

内部程序错误 认真检查下
------解决方案--------------------
网上有说重装myeclipse可解决问题的,我试了下,还是不行;又重装了下jdk,还是不行....
求大侠指点一二.
------解决方案--------------------
jdk版本正确吧。一些应用的jar你都导入进去了吗