可视化数据库管理工具,也可以用Dos界面下进行操作。
可视化数据库管理工具Navicat
& lt; html>
,& lt; head>
& lt; title>注册界面& lt;/title>
,& lt;/head>
,,
,& lt; body>欢迎来到注册界面,请填写你的信息! & lt;人力资源宽度==?”/?00%”大小的在
,行动=" insert_stu_1 & lt;形式。jsp”方法=" post "在
& lt;表边界=" 0 "宽度=" 238“高度”252“在
& lt; tr> & lt; td>用户名& lt;/td> & lt; td> & lt;输入类型="文本" name=" id "/祝辞;& lt;/td> & lt;/tr>
& lt; tr> & lt; td>密,,码& lt;/td> & lt; td> & lt;输入类型=拔谋尽钡拿?皃asswd”/祝辞& lt;/td> & lt;/tr>
& lt; tr对齐=爸行摹痹?/p>
& lt; td colspan=?”在
& lt;输入类型=疤峤弧奔壑?" https://www.yisu.com/zixun/提交”在,,,,,,
& lt;输入类型=爸刂谩奔壑?" https://www.yisu.com/zixun/取消”在
& lt;/td> & lt;/tr>
& lt;/table>
,,,& lt;/form>
,& lt;/body>
& lt;/html>
insert_stu_1.jsp:
& lt; % @页面语言=进口=" java.sql“java”。*”pageEncoding=" utf - 8 " %在
& lt; html>
& lt; head> & lt; title>插入一条记录& lt;/title> & lt;/head>
& lt; body>
& lt; %字符串driverName=" com.mysql.jdbc.Driver”;
字符串的用户名="根";
字符串userPwd=" aaa312”;
字符串dbName="学生";
字符串url1=" jdbc: mysql://localhost: 3306/" + dbName;
字符串url2=" ?用户=" +用户名+”,密码=" + userPwd;
字符串url3=", useUnicode=true& charsetEncoding=utf - 8”;
字符串url=url1 + url2 + url3;
forname (driverName);
连接康涅狄格州=DriverManager.getConnection (url);
字符串sql="插入students_info (id、密码)值(? ?)”,
PreparedStatement pstmt=conn.prepareStatement (sql);
request.setCharacterEncoding (“utf - 8”);
字符串id=request.getParameter (" id ");
字符串passwd=request.getParameter (“passwd”);
pstmt.setString (id);
pstmt.setString (2, passwd);
int n=pstmt.executeUpdate ();
如果(n==1){%的在你的信息注册成功,欢迎登录! & lt; br> & lt; %}其他{%祝辞注册失败,请重试! & lt; br> & lt; %},
如果(pstmt !=null) {pstmt.close ();}
如果(康涅狄格州!=null) {conn.close();} %在
& lt;/body> & lt;/html>