为何连接oracle数据库总出错???

03-05-19 绿化树

源程序,简单的测试连接:
import java.sql.*;
public class DBCompare {
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
public ResultSet ExecuteQuery(String sql)
throws java.sql.SQLException{
try{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conn=DriverManager.getConnection("jdbc:oracle:thin:@wangdong:1521:oanet","dbwizard","11");
stmt=conn.createStatement();
rset=stmt.executeQuery(sql);
return rset;
}catch(java.sql.SQLException e){
e.printStackTrace();
return null;
}catch(java.lang.Exception ex){
return null;
}
finally{
try{
if(rset!=null)rset.close();
if(stmt!=null)stmt.close();
if(conn!=null)conn.close();
}catch(java.sql.SQLException e){
e.printStackTrace();
}
}
}
public static void main (String[] args)throws java.sql.SQLException{
DBCompare dbCompare = new DBCompare();
String sql = "select user_code,user_name from DB_WIZARD order by user_code";
ResultSet rset = null;
try{
rset=dbCompare.ExecuteQuery(sql);
}catch(Exception e){System.out.println(e.toString());}
if(rset.next()){
System.out.println( rset.getString("user_code"));}
}
}
运行结果:
---------- java ----------
java.sql.SQLException: ORA-00600: 内部错误代码,参数: [ttcgcshnd-1], [0], [], [], [], [], [], []

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java)
at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java)
at DBCompare.ExecuteQuery(DBCompare.java:12)
at DBCompare.main(DBCompare.java:35)
java.lang.NullPointerException
at DBCompare.main(DBCompare.java:37)
Exception in thread "main" Normal Termination
Output completed (6 sec consumed).