A "no database selected" message is returned when going to the /oauth/manager service (aka "OAuth Manager") from a web browser. The CA API Gateway logs show "Perform JDBC Query assertion failed due to: No database selected."
This can occur in any CA API Gateway that is running the OAuth Toolkit (OTK), or any policy which contain active Perform JDBC Query assertions.
This message is returned when there is no JDBC connection set in the Perform JDBC Query assertion, or if there is no database name in the JDBC Connection URL string.
There are two resolutions, either one may apply to this issue:
- Ensure that there is a JDBC connection set in the Perform JDBC Query assertion. This is a drop-down list which contains all the JDBC connectors that exist in the environment. If no connection is set, the assertion will fail and the "no database selected" error may be seen in the logs. More information on this assertion can be found in the product documentation.
- Ensure that there is a database name in the JDBC Connection URL string on the appropriate JDBC Connection. If it is a MySQL database server - for example - then the URL string should look similar to this: jdbc:mysql://localhost:3306/abcd. The 'abcd' in that example URL is the database name. Please note that the Test button will still succeed even without a database name as it only checks for a proper connection (i.e. hostname is resolvable and reachable). The behaviour will not be noticed until a proper transaction takes place consuming the policy with the Perform JDBC Query assertion. More information on JDBC Connection properties and the related URL strings can be found in the product documentation.