日期:2014-05-16 浏览次数:20422 次
<%@ page contentType="text/html;charset=gb2312"%> <%@ page import="java.sql.*"%> <% final String MYSQLDBDRIVER="org.gjt.mm.mysql.Driver"; final String MYSQLDBURL="jdbc:mysql://localhost/mldn"; final String MYSQLDBUSER="root"; final String MYSQLDBUSERPASS="root"; Connection con = null; %> <% try{ Class.forName(MYSQLDBDRIVER); con = DriverManager.getConnection(MYSQLDBURL,MYSQLDBUSER,MYSQLDBUSERPASS); Statement stmt = con.createStatement(); String sql ="create table person(name varchar(32))"; //执行创建语句 stmt.executeUpdate(sql); out.println("连接成功!"); stmt.close(); }catch(Exception e){ out.println(e); } %>