Creation of a MySQL DB (in cloud) using a Google Cloud SQL instance (+ Java code)

In this weeks I had to create a DB, accessible from anywhere, to be integrated in an application and web app for a work project.

Here a breif description on my Notion, hope you like it 😁

Useful Java Code for MySQL db in Google Cloud SQL instance interaction:

// Template program for MySQL DB access and usage w. Java
public static void main(String args[]) throws IOException {
            try {
								// to import the JDBC driver
								// tou also need to add them to the project libraries (different for each IDE)
                Connection con = DriverManager.getConnection(
                        // DB_IP = SQL instance IP
												// DB_PORT = instance port (default should be 3306)
												// DB_NAME = database name
												// USERNAME
												// PSSW = password of the username choosen 
                        "jdbc:mysql://DB_IP:DB_PORT/DB_NAME", "USERNAME", "PSSW ");
                Statement stmt = con.createStatement();

								// example of INSERT command / ADD / REMOVE / ECC...
								String query = "INSERT INTO TableName(att1, att2, att3) VALUES" +
									"('" + att1_value+"', '"+att2_value+"', '"+att3_value+ "')" ;
								// use the syntax " 'varchar_value'" for text, with the single superscript
								// else just the variable for numeric values

                //executeQuery to select from tables
                ResultSet rs = stmt.executeQuery("select * from TableName");
								// can add whatever you need to the above query of course

								// to get the attribute for each tuple returned
                while (
                    System.out.println(rs.getInt(1) + " \t " + rs.getString(2) + " \t\t " + rs.getString(3) + " \t\t " + rs.getString(4));
            } catch (Exception e) {
            }//Try catch

Some of my posts:

Pyhton – Loop Videos & Add Audio track

Number and Stats about the Universe

The Solar System

OpenAI says new model GPT-4 is more creative and less likely to invent facts

Try out ChatGPT

Google’s AI generator creates HD video from text !!!

YOLOv7: The Fastest Object Detection Algorithm (2022)

AI-Generated Artwork Wins State Fair Competition, Leaving Human Artists Unhappy

Transfer Learning with Python – Tensorflow

GitHub update : New Repo with all my Tests !!

Tesla Model S Plaid : INSANE !

Turn in Norway: a self-driving bus goes into service!

Microsoft lauched project to train drone AI systems – AirSim

Life in the Universe: What are the Odds?


My New York Times telegam channel is LIVE!! 🗞️🗞️

LaMDA: GOOGLE breakthrough conversation technology

Robotic Arms Allow Partially Paralyzed Man To Feed Himself Cake For First Time In 30 Years

Update – Repo GitHub crypto indicators

Apple WWDC 2022 – iOS 16 and more !!

Useful links: