Connecting to oracle 11 server from eclipse with service name

I would like to connect to Oracle 11g Enterprise DB from eclipse within a JPA project. I have a Service Name, U / P and Hostname. But the parameter given to me in eclipse is the SID, which I don't have.

I am using SQL Developer to connect to the database and it works great. I'm not sure how to connect from eclipse with service name. any help? I tried to provide the service name for the SID. It didn't work.

I am using is ojdbc14.jar. Not sure if this is the correct Jar.

+3


source to share


5 answers


You can use the Generic JDBC connection profile and specify the URL directly: jdbc:oracle:thin:@//host:port/service_name



+4


source


SID

or the system ID is generated when installed oracle11g

on your system. He's always there.

I suggest you go Edit Connection

on Sql Developer

and search SID

, it should be there.

Alternatively, you should have a file tnsnames.ora

located in the ORACLE_HOME

> Network

> Admin

He looks somewhat as follows:



LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = XXXX))

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = XXXX))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

      

The search SERVICE_NAME=orcl

on the last 3rd line, here in orcl

, is yours SID

, which you should use to connect to oracle

from eclipse

.

0


source


When creating a connection to a new database, you can also fix this by using "Other Driver" instead of Oracle JDBC Thin Driver. But when adding Drivers to the Connection Profile, you must add the same ojdbc banner that you usually use and add any properties on the Properties tab under Define New Driver. The first error you can get: A required property in the driver definition is missing a value: Driver class.

0


source


Please use the complete connection url as shown below. JDBC: oracle: thin: @ (DESCRIPTION = (ADDRESS = (HOST = MyHost) (PORT = 1521) (PROTOCOL = TCP)) (CONNECT_DATA = (SERVICE_NAME = myorcldbservicename)))

0


source


you need to change the driver to ojdbc6

1. -cick to ojdbc14.jar and select uninstall
 2. Click "add jar" and navigate to the location and download it orcaleDB then follow this path "\ oraclexe \ app \ oracle \ product \ 11.2. 0 \ server \ jdbc \ lib "
3.select the ojdbc6 driver and exit

0


source







All Articles