I am trying to connect to my oracle 11g DB with a java program and it is giving errors described below. It is fine When try to connect from SQL developer.
By using ojdbc5.jar in program, getting the below exception,
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
By using ojdbc14.jar, getting the below one,
java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=186647552)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
Do i need to change the format of passing URL, user name and password? I have passed below string to establish connection.
jdbc:oracle:thin:@host:1521:SID
Any ideas?