+ 1
IDK if this is outdated, but I did it this way years ago utilizing JDBC, no other time since
import java.sql.* lib
Have a Connection object, we'll call it connection
Use PreparedStatement objects for each statement you want
connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
prepare your statements
connection.prepareStatement("SELECT * FROM myDB");
Thats just the constructor.
Adding data, or INSERT INTO x (a,b,c,d) VALUES (?,?,?,?)
pps.setString(1, a);
pps.setString(2, b);
...
pps.executeUpdate();
IIRC, these require try-catch blocks