daust / JasperReportsIntegration

JasperReportsIntegration provides an interface to use the JasperReports reporting engine in an Oracle database application, specifically with Oracle Application Express (Oracle APEX).
BSD 3-Clause "New" or "Revised" License
55 stars 23 forks source link

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

Closed daxlai closed 3 years ago

daxlai commented 3 years ago

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 commented 3 years ago

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"
  3. restart Tomcat
  4. 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
  5. try again.
daust commented 3 years ago

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 commented 3 years ago

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

daxlai commented 3 years ago

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

daust commented 3 years ago

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 commented 3 years ago

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