import java.sql.*; public class SQLHelper { private final static String JDBC_USER = "mysql"; private final static String JDBC_PASSWD = ""; private final static String JDBC_DRIVER = "org.gjt.mm.mysql.Driver"; private final static String JDBC_URL = "jdbc:mysql://localhost:3306/asset"; public SQLHelper() { try { Class.forName(JDBC_DRIVER); } catch(ClassNotFoundException cnfe) { System.out.println("Error loading JDBC Driver: " + cnfe.getMessage()); } } public String sampleSubmit(/* parameters */) { StringBuffer sb = new StringBuffer(); try { String sql = "insert into XXX (FIELD1, FIELD2, ..., FIELDN) values "; // sql += "('" + VALUE1 + "','" + VALUE2 + "')"; Connection connection = DriverManager.getConnection(JDBC_URL, JDBC_USER, JDBC_PASSWD); Statement statement = connection.createStatement(); int num = statement.executeUpdate(sql); statement.close(); connection.close(); sb.append("
Inserted " + num + " new Row(s)
"); } catch(SQLException sqle) { sb.append("
"); results.close(); statement.close(); connection.close(); } catch(SQLException sqle) { sb.append(""); while (results.next()) { int id = results.getInt(1); String title = results.getString(2); String description = results.getString(3); sb.append("
" + title + " "); } sb.append("