Simply put, JDBC can do three things:
1. Establish a connection with the database
2. Send SQL statements
3. Processing results.
The following code segments give the above three steps:
// Establish a database connection
Connection Con = DriverManager.getConnection ("JDBC: ODBC: Wombat", "Login", "Password");
// Create a Statement object
Statement Stmt = con.createstatement ();
/ / Execute the SQL statement and return the result
ResultSet RS = Stmt.executeQuery ("SELECT A, B, C from Table");
While (rs.next ()) {
INT x = rs.Getint ("a");
String s = rs.getstring ("b");
Float f = rs.getfloat ("c");
}