eclipse连接oracle 10g数据库时出错
eclipse连接oracle 10g数据库时出现如下错误提示:
testing oracle-character-set-1 against <abc>
PASSED LOSSY
testing oracle-character-set-1 against <ab?c>
PASSED LOSSY
testing oracle-character-set-1 against <XYZ>
PASSED LOSSY
testing oracle-character-set-1 against <longlonglonglong...>
PASSED LOSSY
testing oracle-character-set-31 against <abc>
PASSED LOSSY
testing oracle-character-set-31 against <ab?c>
PASSED LOSSY
testing oracle-character-set-31 against <XYZ>
PASSED LOSSY
testing oracle-character-set-31 against <longlonglonglong...>
PASSED LOSSY
testing oracle-character-set-870 against <abc>
PASSED
testing oracle-character-set-870 against <ab?c>
PASSED
testing oracle-character-set-870 against <XYZ>
PASSED
testing oracle-character-set-870 against <longlonglonglong...>
PASSED
testing oracle-character-set-871 against <abc>
PASSED
testing oracle-character-set-871 against <ab?c>
PASSED
testing oracle-character-set-871 against <XYZ>
PASSED
testing oracle-character-set-871 against <longlonglonglong...>
PASSED
程序源代码如下:
import java.sql.Connection;
import java.sql.DriverManager;
import
java.sql.SQLException;
public class DBConnection
{
public static Connection dbconn(String name,String pass)
{
Connection conn = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver ");
} catch (
ClassNotFoundException e)
{
e.printStackTrace();
}
try
{
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe",name,pass);
} catch (
SQLException e)
{
e.printStackTrace();
}
return conn;
}
}
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class DB extends DBConnection
{
/**
* @param args
*/
private static Connection con = null;
public static void main(String[] args)
{
// TODO Auto-generated method stub
con=dbconn("system","********");
if(con==null)
{
System.out.println("
连接失败,程序将终止!");
System.exit(0);
}
String sqlword="select * from workers";
try
{
PreparedStatement pres=con.prepareStatement(sqlword);
System.out.print(pres.execute());
con.close();
} catch (SQLException e)
{
e.printStackTrace();
}
}
}
引用的库中已加入ojdbc14.jar。
是我的程序中那些错了吗?还是?请高人指教!非常感谢!
------解决方案--------------------
先用pl/sql dev试试能正常连接不