按照java code conventions写:
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc
dbc:testDB";
Connection con = DriverManager.getConnection(url, "", "");
Statement statement = con.createStatement();
String query = "select * from testTable";
ResultSet result = statement.executeQuery(query);
while (result.next()) {
out.println(result.getString(1));
}
} catch (Exception ex) {
System.out.println(ex);
}