Hello everyone,
I’ve read that i can normally use java code with processing code in one program.
I created the following class to connect to MYSQL online server “which i created online”
import java.sql.*;
class Database
{
void Database ()
{
}
void createDatabase ()
{
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection ("jdbc:mysql://remotemysql.com:3306/gPQbxUed4a","gPQbxUed4a","********");
Statement stmt = con.createStatement();
stmt.executeQuery("use gPQbxUed4a;");
stmt.executeQuery("create table emp(id int(10),name varchar(40),age int(3));");
con.close();
}
catch (Exception e)
{
System.out.println(e);
}
}
}
in the main sheet i create instance of the database and run createDatabase method
Database myDatabase = new Database();
myDatabase.createDatabase();
after running the code a table should be created in my database. However, I’m checking the database and nothing is happeneed