gpt4 book ai didi

java.sql.SQLRecoverableException : The Network Adapter could not establish the connection

转载 作者:行者123 更新时间:2023-12-01 22:39:45 35 4
gpt4 key购买 nike

这是我正在使用的代码(Oracle 数据库连接):

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@loclahost:1521:XE","system","system");
System.out.println("connection is established");
Statement stmt=conn.createStatement();
int i=stmt.executeUpdate("insert table students ( name varchar2(15),mobile number(10),age varchar2(1))");
System.out.println("Save Sucessfully");
stmt.close();
conn.close();
} catch(Exception e) {
System.out.println(e);
}
this.dispose();

出现以下错误:

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection

最佳答案

您的连接字符串中有拼写错误 - 请使用 localhost 而不是 loclahost

关于java.sql.SQLRecoverableException : The Network Adapter could not establish the connection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26377764/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com