2

I'm migrating from Crystal report 2012 to 2020 and connecting crystal report 2020 with an oracle 19c, but when i try to connect my application (using Java) with Crystal Report Java gives me an error. Specifically:

Connection error: The oracle url is not valid

but in the logs I saw that is using the correct url

Connection logon:Database DLL=s(crdb_jdbc.dll);Use JDBC=b(true);Connection URL=s(jdbc:oracle:thin:{userid}/{password}@serverName:1521:dataBaseSID);Database Class Name=s(oracle.jdbc.driver.OracleDriver);Server=s(serverName);Trusted_Connection=b(false);JDBC Connection String=s(!oracle.jdbc.driver.OracleDriver!jdbc:oracle:thin:{userid}/{password}@serverName:1521:dataBaseSID);PreQEServerName=s(jdbc:oracle:thin:{userid}/{password}@serverName:1521:dataBaseSID);database=s();User ID=s(testUserDB);Password=

I tried many url configurations like

jdbc:oracle:thin:{userid}/{password}@//serverName:1521/dataBaseServices

jdbc:oracle:thin:@serverName:1521:dataBaseSID

jdbc:oracle:thin:@//serverName:1521:dataBaseSID

jdbc:oracle:thin:@serverName:1521/dataBaseServices

jdbc:oracle:thin:@//serverName:1521/dataBaseServices

but none of these work, and I don't know what is causing the error. The curious part is that if I try any of those urls with, with crystal report 2020, they work perfectly - but with java I receive the url error.

I also try to change the class name from oracle.jdbc.driver.OracleDriver to oracle.jdbc.OracleDriver but without lucky.

the line that is giving the error is:

reportClientDocument.getDatabaseController().logon("testUserDB", "passwordBD");

the class report client document use this library com.crystaldecisions.reports.sdk.ReportClientDocument; I tried to change that library for com.crystaldecisions.sdk.occa.report.application.ReportClientDocument and I had the same error.

I'm using Spring Tool Suite 4 as IDE that is base on eclipse 4.15.0, JDK 1.8 and ojdbc8 (connector to oracle 19c)

I already downloaded the libraries, features and plugins of Crystal Reports for Eclipse SP27 and installed in my environment and even with that, |I still have the same problem.

Menelaos
  • 22,383
  • 14
  • 83
  • 147

2 Answers2

1

See the following post: Java JDBC - How to connect to Oracle using Service Name instead of SID

The correct format you should use is the following:

jdbc:oracle:thin:@//<host>:<port>/<service>

So, for example:

 jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename
 jdbc:oracle:thin:userId/Password@//servername:1521/dataBaseService

You could also try the TNS format:

jdbc:oracle:thin:@(description=(address=(host=HOSTNAME)(protocol=tcp)(port=PORT))(connect_data=(service_name=SERVICENAME)(server=SHARED)))
Menelaos
  • 22,383
  • 14
  • 83
  • 147
-1

Verify whether the Oracle instance is configured for Multithreaded Server (MTS). If the Oracle instance is not configured for MTS, you are probably encountering a different problem. Otherwise, continue. Try forcing the JDBC connection to use a dedicated server instead of a shared server. This can be accomplished in several ways. For JDBC OCI or Thin, this can be done by reconfiguring the server for dedicated connections only. This approach, however, may not be feasible in many cases. In such cases, the following options apply: For JDBC OCI:

1) Add the (SERVER=DEDICATED) property to the TNS connect string

stored in the tnsnames.ora file on the client.

2) Set the user_dedicated_server=ON in sqlnet.ora on the client.

For JDBC Thin: You must specify a full name-value pair connect string (the same as it might appear in the tnsnames.ora file) instead of the short JDBC Thin syntax. For example, instead of

"jdbc:oracle:thin:@host:port:sid"   
you would need to use a string of the form
    
"jdbc:oracle:thin:@(DESCRIPTION="                    +
                       "(ADDRESS_LIST="              +
                           "(ADDRESS=(PROTOCOL=TCP)" +
                                    "(HOST=host)"    +                                      
                                    "(PORT=port)"    +
                           ")"                       +
                         ")"                         +
                       "(CONNECT_DATA="              +
                           "(SERVICE_NAME=sid)"      +
                           "(SERVER=DEDICATED)"      +
                       ")"                           +
                     ")"
Nadeem Taj
  • 117
  • 4
  • 21