Java – unable to create eclipse data source to Oracle 12C. Jar But 11g’s work
When I open the data source Explorer window and try to create a new connection profile, I select "oracle", Oracle thin driver, and then I point to the following jar file on my PC:
C:\oracle_12101_64bit\product\12101_64bit\CLIENT_1\jdbc\lib\ojdbc7.jar
After providing the connection parameters, it will export the connection URL in the following format
jdbc:oracle:thin:@host:PORT:SID
But what I want is this (note the colon, not the forward slash)
jdbc:oracle:thin:@host:PORT/SID
I seem to be able to use the generated URL to connect to the 11g database, but it's not 12C. I don't know if it's a coincidence or if I have a different problem
In my program, I use JPA and read a connection URL from the required configuration file in forward slash format. If I change the URL to use colon, the program can connect and the connection fails
If I can't control the derived connection URL to generate a URL with a slash instead of a colon, how do I create a connection profile in eclipse's data source Explorer view? My mistake is:
ORA-12505,TNS:listener does not currently kNow of SID given in connect descriptor
Update 1
One thing I noticed was that even if I associated JDBC 7.0 with Oracle 12C Jar file, and the driver is still displayed as "Oracle 11."
Update 2:
Here are my tnsnames An example in the 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 seems that the connection string builder only needs one sid What's my sid? How do I know? I tried afdev and afdev MYCO. COM. In the case of 11g, I use the equivalent of afdev Sorry, I don't quite understand SIDS and service names Is there a query that I can tell me the SID for DB?
Solution
This seems to be a limitation of the eclipse Oracle thin driver template You are only allowed to specify the SID for the connection, not the service name; And you do not know the SID or it is not registered with the listener (your DBA needs to solve it)
If you create a new driver from the Oracle Database 11g driver template instead of the Oracle thin driver template and point it to 12C ojdbc7 Jar file, you will have the option to provide the service name Then, it will generate a file like JDBC: Oracle: thin: @ / / servername sys. MYCO. com:2/afdedev. MYCO. Com
It's still the same thin driver, and eclipse seems to know it better,