When I open up the Data Source Explorer window and try to create a new Connection Profile, I select "Oracle", the Oracle Thin Driver, and then I point it to the following JAR file on my PC:
C:\oracle_12101_64bit\product\12101_64bit\CLIENT_1\jdbc\lib\ojdbc7.jar
After supplying the connection parameters, it derives a connection url in the following format using the
jdbc:oracle:thin:@host:PORT:SID
However, what I want it to derive is this (note the colon instead of a forward slash)
jdbc:oracle:thin:@host:PORT/SID
I seem to be able to connect to 11g databases using the generated url, however, not a 12c, I don't know if this is coincidental or if I have a different issue.
In my program I use JPA and it reads a connection url from my config file in the desired forward slash format and the program is able to connect and the connection fails if I change the url to use a colon instead.
How do I create a Connection Profile in the Eclipse's Data Source Explorer view if I cannot control the derived connection url to generate a url with a slash instead of a colon? The error I am getting is:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
Update 1
One thing that I noticed is that even if I associate the jdbc7.jar file that comes with Oracle 12c, the driver still is displayed as though it is "Oracle 11."
Update 2:
Here is a sample of what is in my tnsnames.ora file:
AFDEDEV.MYCO.COM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = servername.sys.MYCO.com)(PORT = 2))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = afdedev.MYCO.com)
)
)
It looks like the connection string builder expects only a SID. what would my SID be or how can I find out? I tried both AFDEDEV and AFDEDEV.MYCO.COM. In the 11g case that did work, I used the equivalent of AFDEDEV. Sorry, I don't really understand SIDs vs. SERVICE NAMES that well. Is there a query that I could perform against the db to tell me the SID?
Java Standards Supports JDK8, JDK11, and JDK17 and implements JDBC 4.2 and JDBC 4.3 by ojdbc11. jar (21c) and ojdbc10. jar (19c).
According to the Oracle JDBC FAQ (Question "What are the Oracle JDBC releases Vs JDK versions?"), only the Java versions you listed (Java 8 to 11) are supported for Oracle 19c. I expect that support for later Java versions will be added in the future.
Class OracleDriver. The Oracle JDBC driver class that implements the java. sql.
This seems to be a restriction of the Eclipse 'Oracle Thin Driver' template. It is only allowing you to specify a SID for the connection, not a service name; and either you don't know the SID or it isn't registered with the listener (which your DBA would need to resolve).
If you create a new driver from the 'Oracle Database 11g Driver' template, rather than the 'Oracle Thin Driver' template, and point it to your 12c ojdbc7.jar file, then you will be able to choose to supply a service name instead. That will then generate a URL like jdbc:oracle:thin:@//servername.sys.MYCO.com:2/afdedev.MYCO.com
.
It's still the same thin driver, Eclipse just seems to understand it better,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With