java连oracle中连不上,错误是“无法从套接字读取更多的数据”,是什么问题?

来源:百度知道 编辑:UC知道 时间:2024/09/22 04:10:12
没有任何查询,就有这种错,连接方式是最简单的。
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";
应该不是程序的问题,是不是oracle没配置好。
oracle重装过。以前没这个问题。
有啊
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String user="scott";
String password="tiger";
Connection conn=DriverManager.getConnection(url,user,password);

sys没作用

public class JDBC {

private static String jdbcdriver;
private static String jdbcurl;
private static String username;
private static String password;

public static Connection getConnection(){
Connection con = null;
try{
if(jdbcdriver ==null){
InputStream ins = JDBC.class.getClassLoader().getResourceAsStream("mysql.properties");
Properties prop = new Properties();
try{
prop.load(ins);

jdbcdriver = prop.getProperty("mysql.driver");
jdbcurl = prop.getProperty("mysql.url");
username = prop.getProperty("mysql.username");
password = prop.getProperty("mysql.password");
System.out.println("已经建立连接.....");
}catch(Exception e){
e.printStackTrace();

}
}
Class.forName(jdbcdriver);
con = DriverManager.getConnection(jdbc