配置参数

1.自己创建Java web项目时需要一个web.xml文件,内容如下:



java - mysql:

String url = "jdbc:mysql://localhost:3306/gl";
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(url,"root","******");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select * from hello");
while(rs.next()){
System.out.println(rs.getString(1)+" ---> " + rs.getString(2));
}

你可能感兴趣的:(java,web)