20201104张龙

知识总结
public static void save() throws Exception {// 1、加载数据库驱动
Class.forName("com.mysql.jdbc.Driver");// 2、创建数据库连接
Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/db_user","root","");// 3、拼写sql语句
String sql = "INSERT INTO t_user (userName,passWord,gender)VALUES('李白','rb123','女')";// 4、发送sql
PreparedStatement prepareStatement = connection.prepareStatement(sql);// 5、执行sql
int i = prepareStatement.executeUpdate();// 6、处理结果
if(i > 0) {
System.out.println("添加成功")
} //7、关闭资源
prepareStatement.close();
connection.close();
新建一个文件-new-other-web-dynanic web project-shopping-
next-next-对号-finish
java resources-src-右键-new-package-com.itlaobing.dbhelper
-右键-class-DBHelper
java resources和webcontent中复制HTML中的文件的复制到esp中
content-other-jsp-file-index.jsp-finish
window-最后-server-runtime-add-apache9.0-找目录文件的路径
-finish-apply and close
buid path-configur-lib-addlib-server runtime-选中Apache9.0-a
pply and close
server-右键-and remove-shopping
window-preperences-web-jsp files-utf_8-apply and close
window-preperences-other-utf_8
再将html改成jspwindow-preperences-server-runtime environm
ents-add-9.0-next-路径-finish-apply and close

个人心得
今天继续学习eclipse,依旧懵逼,依旧啥也不懂,还是的努力啊

标签

评论

© 2021 成都云创动力科技有限公司 蜀ICP备20006351号-1