Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

JDBC Connection String for Oracle not connecting

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.

question from:https://stackoverflow.com/questions/65931475/jdbc-connection-string-for-oracle-not-connecting

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...