我如何将数据存储在mysql数据库中 [英] how can i store my data in mysql database
本文介绍了我如何将数据存储在mysql数据库中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%@page import="java.sql.*,java.util.*"%><%String pname=request.getParameter("pname");String address=request.getParameter("address");String contact=Integer.parseInt(request.getParameter("contact"));String email=request.getParameter("email");String subject=request.getParameter("subject");String comments=request.getParameter("comments"); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/roseindia", "root", "root"); Statement st=con.createStatement(); int i=st.executeUpdate("insert into mis-db(pname,address,contact,email,subject,comments) values('"+pname+"','"+address+"','"+contact+"','"+email+"','"+subject+"','"+comments+"')"); out.println("Data is successfully inserted!"); } catch(Exception e){ System.out.print(e); e.printStackTrace(); } %>
我有此类用于在数据库中存储数据.但是我不知道如何在我的网页中实现此类.
我的数据库名称是mis-db
我想在我的数据库中存储数据.请帮助我
i have this class for store data in data base.but i dont know how can i implement this class in my webpage.
my databse name is mis-db
i want to sotre data in my database.plz help me
推荐答案
我不想在本周末对此大惊小怪,请查看本教程
MySQL Java教程 [ ^ ](解释清楚)
I don''t want bang my head with this on this weekend so check this tutorial please
MySQL Java tutorial[^](with clear explanation)
这篇关于我如何将数据存储在mysql数据库中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文