Linux-JSP-JDBC-MySQL Test - SELECT
Keywords: Java, JSP
<% - Author: Raymond [hhzqq@21cn.com] Date: 2000-08-04 features: Linux-JSP-JDBC-MySQL test - Select -%> <% @ page contentType = "text / html; charset = 8859_1 "%> <% // declaration java.sql.connection sqlconn; // database connection object java.sql.statement SQLSTMT; // statement object java.sql.resultset Sqlrst; // Results Object // Register JDBC driver Class.Forname ("org.gjt.mm.mysql.driver"). NewInstance (); // Connect database SQLCONN = java.sql.driverManager.getConnection ("JDBC: MySQL: // localhost / test", "test" , "test"); // create a statement object sqlStmt = sqlConn.createStatement (java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY); // execute SQL statements sqlRst = sqlStmt.executeQuery ( "select name, age From test ");%>