+ 3

Jdbc connectivity of a simple java program to a xampp mysql server remotely located on googlecloud instance.

I want to connect my java program to the database that is created on remote cloud (google cloud instance) through xampp I've red this code : Class.forName("com.mysql.jdbc.Driver"); String url= String.format("jdbc:mysql://x:3306/y"); connection = DriverManager.getConnection(url, z, w); Where x is your instance IP (get it from the panel), y is the instance name, z is the database (not account) and w is the user password. Where will i write my database name? Correct me if I'm going wrong somewhere.

11th Dec 2017, 1:32 PM
Ashish Maheshwari
Ashish Maheshwari - avatar
5 Réponses
+ 6
I have no experience with Java database applications, but I found this link related to JDBC, hope it could come of use somehow, if you still haven't solved the case. https://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm Hth, cmiiw
17th Dec 2017, 4:50 AM
Ipang
27th Mar 2018, 8:52 AM
JULIUS FREDRICK
JULIUS FREDRICK - avatar
+ 3
@Ashish Maheshwari I am glad if it helps you with your problem. Good job buddy ; )
28th Dec 2017, 3:17 PM
Ipang
+ 3
thank you for your help.
3rd Apr 2018, 9:49 AM
rhoda 🔥
rhoda 🔥 - avatar
+ 2
Hello @ipang thanks for answer, the link you shared is correct. The main point is you have to replace "localhost" that you are using (x:3306) to the instance ip address. And rest is just database name and user pass. ✌️
28th Dec 2017, 3:12 PM
Ashish Maheshwari
Ashish Maheshwari - avatar