I am using an application which needs to access my oracle database to do some tasks with my data.
That application needs two properties, which are:
The JDBC database URL. This is a string of the form jdbc:subprotocol:subname. For a MySQL database, this is something like jdbc:mysql://hostname:port/dbname. Examples for other databases #
The JDBC driver class name for the database. Used together with d2rq:jdbcDSN. Example: com.mysql.jdbc.Driver for MySQL. #
I want to connect to an Oracle database that has this version
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
"CORE 11.2.0.4.0 Production"
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
Normally I connect to my oracle database using a SQL developer
application where I just set:
Now to connect to my database from this new app (now the sql developer), i am required to do (from this page http://www.devx.com/tips/Tip/28818)
jdbc:oracle:thin:@<HOST>:<PORT>:<SID>
oracle.jdbc.driver.OracleDriver
so I changed that template to:
jdbc:oracle:think:@HostName:port:ServiceName
and I copied the ojdbc6.jar
to the bin folder
when I run, i get this error:
Database connection to jdbc:oracle:thin:@HostName:Porto:ServiceName failed (user: UserName): Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect description
It sounds like the SID should be be replaced by service name. (i am not sure) do you have any idea about how to solve it and if what I did is correct?
I found the error
it should be like this
jdbc:oracle:thin:@hostname:porto/servicename
not
jdbc:oracle:thin:@hostname:porto:servicename