0
package JDBC;
import java.sql.*;
public class Project {
public static void main(String[] args)
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection Con = DriverManager.getConnection("jdbc:oracle:thin:scott/[email protected]:1521:productDB”");
Statement st=Con.createStatement();
String sql = "select * from emp";
ResultSet rs = st.executeQuery(sql);
while (rs.next())
System.out.println(rs.getInt(1)+" "+rs.getString(2));
Con.close();
}
catch (Exception e)
{
System.out.println(e);
}
}
}
エラーは次のとおりです。私はOracleに私のJavaコードを接続しますが、その私にエラーを与えます:
java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
@RudyVissers答えが見つかると、重複してマークしてください。 –
[ネットワークアダプタがSQL開発者で接続を確立できませんでした]の重複している可能性があります(http://stackoverflow.com/questions/24524694/the-network-adapter-could-not-establish-the-connection-in-sql-開発者) –