import java.sql.SQLException;
import oracle.jdbc.pool.OracleDataSource;
import java.sql.Statement;
import java.util.Properties;
import oracle.jdbc.OracleConnection;
public class Test {
static final String url2= "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP
(HOST=192.168.1.171)(PORT=5521))"+"(CONNECT_DATA =(SERVICE_NAME = rdbms)))";
public static void main(String[] args) throws SQLException {
OracleDataSource ds = new OracleDataSource();
Properties prop = new Properties();
prop.setProperty("user","system");
prop.setProperty("password","manager");
prop.setProperty("internal_logon","sysdba");
prop.setProperty("prelim_auth","true");
ds.setConnectionProperties(prop);
ds.setURL(url2);
OracleConnection conn = (OracleConnection)ds.getConnection();
conn.startup(OracleConnection.DatabaseStartupMode.NO_RESTRICTION);
conn.close();
}
}
取得
Exception in thread "main" java.sql.SQLException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
誰でもこれを手伝ってもらえますか?