JDeveloper and Oracle connection
664955Oct 13 2008 — edited Oct 14 2008Recently I have been connecting to a database on another computer through JDeveloper. I just installed Oracle Express 10g on my computer and am having trouble with the connection. After setting up the connection under "Connections" in the JDeveloper navigator, I press test, and it connects with "Success!" I am using a connection Type: Oracle (JDBC), driver: thin, hostname: localhost, port 1521, SID: XE.
But when I run my program, I get this error:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl
My class connects using this code:
public void setDBConnection() throws SQLException{
OracleDataSource ds;
ds = new OracleDataSource();
ds.setURL(jdbcUrl);
mConn = ds.getConnection(userid,password);
}
where jdbcUrl ="jdbc:oracle:thin:localhost:1521:XE";
and of course my userid and password are correct.
I don't understand why it comes back with the SID "orcl"
My listener.ora is this: , where my computer name is STACECASE. I also tried it with LOCALHOST
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\10.2.0\server)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
(ADDRESS = (PROTOCOL = TCP)(HOST = STACECASE)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)