Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to connect Oracle Free Cloud database or Autonomous database #68

Closed
daxlai opened this issue Dec 14, 2020 · 6 comments
Closed

How to connect Oracle Free Cloud database or Autonomous database #68

daxlai opened this issue Dec 14, 2020 · 6 comments
Assignees
Labels

Comments

@daxlai
Copy link

daxlai commented Dec 14, 2020

i download wallet and configured as documents but still unable to connect with my cloud database. can help me step by step or more details document or method to connect autonomous database using jre-2.7.0 on tomcat.

[datasource:ligitime]
type=jdbc
name=default
url=jdbc:oracle:thin:@ligitime_high?TNS_ADMIN=C:\Wallet_LIGITIME
username=ligitime
password=

error----
HTTP Status 500 – Internal Server Error
Type Exception Report

Message Could not connect via JDBC: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLRecoverableException: IO Error: Invalid connection string format, a valid format is: "host:port:sid"

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

java.lang.RuntimeException: Could not connect via JDBC: Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLRecoverableException: IO Error: Invalid connection string format, a valid format is: "host:port:sid"
de.oc.utils.Utils.throwRuntimeException(Utils.java:18)
de.oc.db.ConnectionUtility.getConnection(ConnectionUtility.java:158)
de.oc.integration.jasper.webapp.AppConfig.getConnection(AppConfig.java:427)
de.oc.integration.jasper.webapp.ReportWrapper.service(ReportWrapper.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.

@daust
Copy link
Owner

daust commented Dec 14, 2020

This is so weird. I can reproduce it but it does not make any sense. That syntax works on my Mac (although I use / instead of \).

On Windows I get the same error as you do. It seems to be related to the \ somehow.

I could find a workaround for now.

  1. use jdbc:oracle:thin:@ligitime_high as the url
  2. set the tns environment through the java environment. E.g. create a file setenv.bat in the bin directory of tomcat, where you can find startup.bat as well.
set JAVA_OPTS="-Doracle.net.tns_admin=C:\Wallet_LIGITIME"
  1. restart Tomcat
  2. check the logfile that Tomcat did pick up the parameter, e.g.:
 Server version:        Apache Tomcat/9.0.4
 Server built:          Jan 18 2018 19:42:17 UTC
 Server number:         9.0.4.0
 OS Name:               Windows 10
 OS Version:            10.0
 Architecture:          x86
 Java Home:             C:\Program Files\Java\jdk1.8.0_161\jre
 JVM Version:           1.8.0_161-b12
 JVM Vendor:            Oracle Corporation
 CATALINA_BASE:         C:\Program Files\Apache Software Foundation\Tomcat 9.0
 CATALINA_HOME:         C:\Program Files\Apache Software Foundation\Tomcat 9.0
 Command line argument: -Doracle.net.tns_admin=D:\Wallet_DB201909172
 Command line argument: -Dcatalina.base=C:\Program Files\Apache Software Foundation\Tomcat 9.0
 Command line argument: -Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 9.0
 Command line argument: -Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 9.0\temp
  1. try again.

@daust daust self-assigned this Dec 14, 2020
@daust daust added the bug label Dec 14, 2020
@daust
Copy link
Owner

daust commented Dec 14, 2020

Another solution seems to be to change the \ into a /:

url=jdbc:oracle:thin:@ligitime_high?TNS_ADMIN=C:\Wallet_LIGITIME
=>
url=jdbc:oracle:thin:@ligitime_high?TNS_ADMIN=C:/Wallet_LIGITIME

Please try and provide feedback.
Thanks.

@daust
Copy link
Owner

daust commented Dec 14, 2020

I did also try to upgrade the jdbc libraries to 19.8 ... still the same issue.

@daxlai
Copy link
Author

daxlai commented Dec 15, 2020

Another solution seems to be to change the \ into a /:

url=jdbc:oracle:thin:@ligitime_high?TNS_ADMIN=C:\Wallet_LIGITIME
=>
url=jdbc:oracle:thin:@ligitime_high?TNS_ADMIN=C:/Wallet_LIGITIME?
Working fine . Thank you. Close the requeste

@daxlai daxlai closed this as completed Dec 15, 2020
@daust
Copy link
Owner

daust commented Dec 15, 2020

This is so weird, I guess the following might work as well:

url=jdbc:oracle:thin:@ligitime_high?TNS_ADMIN=C:\\\Wallet_LIGITIME

can you try that?

Have checked my code, am a bit confused. In a different project of mine it works. But there I retrieve the connection url from a JSON file and there you need to escape a \ => \\. \\\ just doesn't make any sense to me ... will investigate a bit further.

Will be a challenge for people as it is.

@daust
Copy link
Owner

daust commented Dec 15, 2020

I have updated the documentation with a comment in the full installation section and also the troubleshooting section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants