How to connect to a Google Cloud SQL database using Java - java

I am in the process of making my database cloud based, however I'm having trouble connecting to it. I have followed this
https://cloud.google.com/sql/docs/mysql/connect-app-engine-standard#java
I think the problem is I am having problems setting up HikariCP in my Java project. As I keep getting the error:
java.lang.NoClassDefFoundError: Could not initialize class com.zaxxer.hikari.HikariConfig
So if anyone has any solutions, either fixing the problem above, or a new way about it I would be very grateful.

Based on the github for Java or the MySQL/Postgres JDBC and R2DBC drivers which allows the user with proper permission to connect to a Cloud SQL database.

Related

Connect Android App with a Firebird Database

I use Android Studio to program an application which allows you to access a Firebird database
I already read that it is not recommended to connect the app directly with the database. Therefore I would highly appreciate if someone could provide a step-by-step instruction on how to establish a connection between a Firebird database and an android application.

Getting a Java Class Cast Extension when attempting to connect to a MySQL Database with NetBeans

I'm currently trying to connect a Java application in NetBeans to interact with a MySQL Database and I am getting the following error when trying to connect:
Cannot establish a connection to jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=convertToNull using com.mysql.jdbc.Driver (java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long)
Anyone know why this would be happening or how I could fix it? As far as I know the JDBC URL I am giving it to make the connection is correct.
To clarify, there is no code in the project that I am attempting to run, I am only attempting to connect to the 'MySql Database'.
Cast that into BigInteger. Please have a look at this question.

Unable to connect from ecllipse to cloud sql using app engine server and java

I am trying to connect from eclipse to cloud sql using app engine server, In SQL authorization I have added my ip address and given #anyhost access. I am using jdbc socketfactory to connect to cloud sql. But I am getting the below exception
please refer this link(exception screenshot)
Please provide error messages as actual text, not images. This makes searching for anything difficult. You also have your instance connection string in the image. I advise you to remove this.
As for answering your question, without more information I can give you a generalized answer.
When connecting from App Engine, you do not need to whitelist any IPs. Whitelisting IPs doesn't actually work with GAE as the IPs may change for new instances.
GAE instances have the Cloud SQL proxy running and you specify the connection details in your pom.xml.
Which exact connection method you need to use depends on your JAVA version, whether you're using GAE Standard or GAE Flexible, and if you're using a 1st or 2nd generation Cloud SQL instance.
This page provides links to details for all of the different scenarios to connect from GAE to Cloud SQL. For local testing of your app, you will have to have the Cloud SQL proxy running locally. This quickstart shows how to set this up.

Android doesn't connect to MS SQL database, but Java console does...?

I am developping an Android app with a sql server, when we try to get records out of the database, we can view them in the java console.
However, when we test our app on Android, the connection is null and we do not see any records?
We're using JTDS 1.2.5 to connect with the database. On Android we receive a SQL-exception when the app attemps a 'getConnection()'
Could you please write the stack trace?
It could be very useful in order to solve the problem.
Without seeying it I can suppose that maybe you've incorrectly loaded the SQL JDBC driver and for this reason the program is unable to load the class.

Configuring Informix database for JDBC Connection

I'm writing my first android app via Eclipse. I am trying to make a connection to my informix database. I have installed informix's client-side drivers on my system and the program picks them up when I run the Class.forName() method. However, my connection URL fails everytime. I have looked at many examples online as well as read much of IBM's documentation on this. I'm convinced there is some type of driver I need to install on my server??
Any insight would be great, thanks!

Categories