1
我试图连接到一个数据库表,获取 java.lang.ClassCastException: oracle.jdbc.driver.T4CStatement cannot be cast to java.beans.Statement
在Oracle 10g Express版在Oracle 10g express版本中获取ClassCastException。
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Driver loaded.");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","toushif");
System.out.println("Connection Established.");
String sql = "SELECT * FROM TOUSHIF";
Statement st = (Statement) con.createStatement();
ResultSet rs = ((java.sql.Statement) st).executeQuery(sql);
while(rs.next())
{
System.out.println(rs.getString(1));
}
你正在得到什么类型的错误? –