第四周汇总

这周学习内容

数据库的初步链接

需要引用SQL包和JDBC包

<%@ page import="com.mysql.jdbc.Driver"%>
<%@ page import="java.sql.*" %> 
使用代码
String driverName = "com.mysql.cj.jdbc.Driver";
String userName = "root";
String passWorld = "password";
String dbName = "test";
String tableName = "kebiao"; 
String url = "jdbc:mysql://localhost//"+dbName+"?user="+userName+"&password="+passWorld;
try{
Connection connection = DriverManager.getConnection(url);
    Statement statement = connection.createStatement();
}
先确认数据库的名字和密码。
再用Statement的变量进行操作;
posted @ 2020-12-15 15:39  韦德·沃兹  阅读(74)  评论(0)    收藏  举报