I only have Oracle 8i installed in my system working fine. I can successfully connect using jdbc to it using driverManager but the problem occurs when I am using OracleDataSource to connect to it. It says Oracle not Available. I guess I am doing something wrong in providing the sid.
Part of my code -
OracleDataSource ds = new OracleDataSource();
ds.setDriverType("thin");
ds.setServerName("localhost");
ds.setPortNumber(1521);
ds.setDatabaseName("ORCL0"); // sid
ds.setUser("scott");
ds.setPassword("tiger");
Connection conn = ds.getConnection();
tnsnames.ora entry (part of it) -
ORACLE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = guddus-comp)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = oracle)
)
)
listener.ora entry (part of it) -
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\oracle\ora92)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = oracle)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = ORCL0)
)
(SID_DESC =
(GLOBAL_DBNAME = dbabhi)
(ORACLE_HOME = C:\oracle\ora92)
(SID_NAME = DBABHI)
)
)
In my code I'v tried oracle, orcl also in place of ORCL0 but anything other than ORCL0 gives Io exception: Connection refused whereas providing ORCL0 gives Exception - ORA-01034: ORACLE not available.... So I guess ORCL0 is correct but I anticipate some other problem.