H2 database Server mode created from Playframework not accessible from SQuirll - jdbc

I have running H2 database locally in server mode.
TCP server running at tcp://192.168.159.1:9092 (others can connect)
When I connect to H2 instance via Playframework aplication using this configuration
db.default.url="jdbc:h2:tcp://192.168.159.1:9092/~/test3"
db.default.driver=org.h2.Driver
db.default.username="sa"
db.default.password="sa"
Everything is fine database is created, evolution scripts are triggered but I cannot connect to that database using for example SQuirell. I keep getting
this error:
java.util.concurrent.ExecutionException: java.lang.RuntimeException: org.h2.jdbc.JdbcSQLException: Wrong user name or password [28000-192]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:345)
at org.h2.message.DbException.get(DbException.java:179)
at org.h2.message.DbException.get(DbException.java:155)
at org.h2.message.DbException.get(DbException.java:144)
at org.h2.engine.Engine.validateUserAndPassword(Engine.java:336)
at org.h2.engine.Engine.createSessionAndValidate(Engine.java:162)
at org.h2.engine.Engine.createSession(Engine.java:137)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:148)
at java.lang.Thread.run(Thread.java:745)
Same is happenig when database is created outside Play, then in Play i'm getting same error. Is this some bug in 2.3.10 ( version of Play)

The Play 2.3.x JDBC datasource is managed by BoneCP
Correctly define User name
db.default.user=sa
So I used settings from more recent version
Play framework 2.5.x is using HikaryCP where this would be correct
db.default.username=sa

Related

Failed to validate newly established connection - Grails 4

We are using Grails 4 framework for our web application with oracle database. Everything work fine when we host the application locally. However, when we migrated the application to production environment, application is getting disconnected with database server intermittently. On checking the tomcat logs we are getting " SQLexception Failed to validate newly established connection" error.
SQL error
Application.yml

java.sql.SQLNonTransientConnectionException: Could not create connection to database server- Google Cloud Platform

I'm trying to create a spring boot application that inserts some data into GCP Mysql.But everytime I'm trying to run application it shows exception -
java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
Caused by: java.io.IOException: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials
Now following is my application.properties file.Actual paparmeters not defined here-
spring.cloud.gcp.sql.database-name=DemoDatabase
spring.cloud.gcp.sql.instance-connection-name=xxxxxxxxxxx
spring.datasource.initialization-mode=always
spring.cloud.gcp.credentials.location=C:/Users/utkar/Downloads/spring-boot-7208e0222fb1.json
spring.datasource.url=jdbc:mysql://google/DemoDatabase?cloudSqlInstance=XXXXXXXXXXX&socketFactory=com.google.cloud.sql.mysql.SocketFactory&useSSL=false
spring.datasource.username=XXXXX
spring.datasource.password=XXXXXX
Please help.Thanks in advance
Run the following command on the CLI:
gcloud auth application-default login

Connecting to Oracle12C database using standalone java client Vs Connecting through Websphere

Connection to Oracle 12c from a standalone java application succeeds when ojdbc6.jar or ojdbc5.jar is used.
Connection String : jdbc:oracle:thin:#serverName:port:sid
Whereas the same connection string fails when connecting through Websphere with the following exception.
java.sql.SQLException: ORA-28040: No matching authentication protocol
DSRA0010E: SQL State = 99999, Error Code = 28,040
Note : Tried ojdbc8.jar and ojdbc6.jar
The ORA-28040: No matching authentication protocol error generally indicates that you are using an older JDBC driver with a newer database. You should either update your JDBC driver so that it is the same version as the database or update your sqlnet.ora file with the appropriate SQLNET.ALLOWED_LOGON_VERSION_SERVER/SQLNET.ALLOWED_LOGON_VERSION_CLIENT values. See Oracle's SQLNET documentation for more information.
Note that if you think you are using the same version JDBC driver as the database it is possible that a different JDBC driver is being picked up in the WebSphere environment. If that is the case:
Check that there are no additional JDBC drivers packaged with your application.
Check if there are other Oracle JDBC Providers configured in WebSphere using an older JDBC driver. If so either modify your configuration so all of your providers are using the same version Oracle JDBC driver or you will need to Isolate your JDBC Providers.

Connect Oracle cloud Database using JDBC java

I have database username and password to access oracle db and also have service url like https://X-X.X.X.oraclecloudapps.com/apex/.
Can anybody know how to connect this db using JDBC connection.
I tried using oracle thin driver but somehow it failes.
Sample java code:
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:#//X.X.X.X.oraclecloudapps.com:1521/sid", "username", "****");
It throws
Exception in thread "main" java.sql.SQLRecoverableException: Io exception: The Network Adapter could not establish the connection
I don't know SID here, it would be helpful if anybody give steps to find SID/ServiceName from Oracle Cloud dashboard.
You can't use JDBC to connect to the Database Schema Service. You can connect using the API or tools that utilize the REST API. For data upload to Oracle Database Schema Service, use Oracle SQL Developer, the Oracle Application Express SQL Workshop Data Upload Utility or the Oracle Application Express Data Load utility. Read more here: http://docs.oracle.com/cloud/latest/dbcs_schema/CSDBU/GUID-3B14CF7A-637B-4019-AAA7-A6DC5FF3D2AE.htm#CSDBU177
There is only three way to connect Database Schema Service.
From an Oracle Application Express application running in Database Schema Service
From a Java application running in an Oracle Java Cloud Service
Through RESTful Web services
Try the following JDBC URL to resolve the issue
"jdbc:oracle:thin:#host-address:1521/sid";
Note / is used after port and Not :

JSTL SQL setDataSource not working with Webshpere 8.5

<sql:setDataSource var="TCIT" scope="application"
driver="${driver}"
url="${url}"
user="${username}"
password="${password}" />
The above code is used in a legacy application deployed in OC4J that is being migrated to WebSphere 8.5. The properties in {} above are fetched from a property file. Ensured the values are coming correctly form there. However, when the database connection is created the application is encountering the following exception: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver" . I have the ojdbc14.jar in the WEB-INF/lib folder, still facing the issue.
Finally the issue got resolved creating a JDBC connection pool at Application server level. Turns out Websphere does not allow the connection to be created using the above method. Below is the modified tag that is using JNDI lookup for accessing the JDBC connection pool at application level.
<sql:setDataSource var="connPool" scope="application" dataSource="${jndi.devPool}"/>

Resources