0

Below are my connection settings for Oracle SQL Developer with tnsnames.ora

enter image description here

enter image description here

The pattern of jdbc string required is as below :

jdbc:oracle:thin@:1521:<DATABASE_NAME>

I have tried the following :

jdbc:oracle:thin:@ServerIP:1521:test2 , jdbc:oracle:thin:@ServerIP:1521:orcl.5bfzmyo25mfutjqfmvvj0cmrya.rx.internal.cloudapp.net:test2

But it is not connecting.

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
Amey
  • 43
  • 1
  • 1
  • 7
  • What is the error when you try to connect? Are you connecting from the same machine where SQL Developer is running? Your SQL Developer connection is to `localhost`. Is the `ServerIP` the IP address of the local machine? – Justin Cave Jan 28 '21 at 05:46
  • Error received is : Check connection string ,username or password.I am connecting from different machine and yes Server IP is the IP of server where oracle is installed. – Amey Jan 28 '21 at 05:53
  • Ok. If you're connecting from a different machine, then your local tnanames.ora file and your local SQL Developer connection settings aren't visible. Specifically, that machine will have no idea what `test2` references. What application are you trying to connect from? There should be a more detailed error stack. – Justin Cave Jan 28 '21 at 06:03

1 Answers1

0

Assuming that

  • You want to use the Oracle thin JDBC driver
  • The database is running on ServerIP
  • The database listener is running on port 1521
  • The service name of the database is orcl.5bfzmyo25mfutjqfmvvj0cmrya.rx.internal.cloudapp.net

your connection string should be (see the linked question for additional syntax options)

jdbc:oracle:thin:@//ServerIP:1521/orcl.5bfzmyo25mfutjqfmvvj0cmrya.rx.internal.cloudapp.net

Your app server has no idea about how you've configured your local tnsnames.ora file or your local SQL Developer connection strings. So you can't reference test2 (the name of a SQL Developer connection) or any of the tnsnames.ora entries you've created on the client machine.

Justin Cave
  • 227,342
  • 24
  • 367
  • 384
  • I am trying to connect to Qlik Data Catalog.Tried your string as well .Getting the same error. core.error.code.TEST_CONNECTION_FAILED - Test connection attempt failed, please check the connection string, user name and password. – Amey Jan 28 '21 at 06:17
  • @Amey - Is the Oracle client installed on the machine you're trying to connect from? If your client really doesn't have the ability to debug the connection, you're likely to need something that can produce some debugging output. As a first step, I'd try making the connection strings as similar as possible. Use the `ServerIP` you're specifying in your SQL Developer connection string, for example, rather than using `localhost`. If you know what the `SID` of your database is, you could use that in the colon-delimited URL. You could try the full TNS alias syntax from the linked question. – Justin Cave Jan 28 '21 at 06:45
  • SID of database is orcl and TNS network alias is ORCL . I had tried the following connection strings as well .first by selecting SID and then the TNS network alias : jdbc:oracle:thin:@//ServerIP:1521:orcl & jdbc:oracle:thin:@//ServerIP:1521:ORCL . But it didnt connect.Are those strings correct? – Amey Jan 28 '21 at 06:53
  • @Amey - They appear correct if the IP address, port, and SID are correct. The one I posted would be correct if the IP address, port, and service name are correct. Either the information you have is incorrect or there is something blocking the connection (i.e. a firewall between the machines). – Justin Cave Jan 28 '21 at 07:00