•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 427,204 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,156 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 619 | Replies: 4
![]() |
•
•
Join Date: Mar 2008
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
hai
i am nireekshan
i am using mySql database in this i am create employe table
Now i am davalep One .HTML Page in this i am write the employe table fieldes-----------And write Jsp page inThis i write MYSQL CONNection code And Insert Prapared Staments
Now i am run TOMCat 5.0 Server,open .HTML page INSERT EMploye Fied Values Submet ok
next Work is Down NOT store data in database
plse see my program tell me any ERROR plse ...............
HTML..............>jsp.................;
i am nireekshan
i am using mySql database in this i am create employe table
Now i am davalep One .HTML Page in this i am write the employe table fieldes-----------And write Jsp page inThis i write MYSQL CONNection code And Insert Prapared Staments
Now i am run TOMCat 5.0 Server,open .HTML page INSERT EMploye Fied Values Submet ok
next Work is Down NOT store data in database
plse see my program tell me any ERROR plse ...............
HTML..............>jsp.................;
JSP Syntax (Toggle Plain Text)
<%@ page import="javax.servlet.*" %> <%@ page import="javax.servlet.http.*" %> <%@ page import="java.io.*" %> <%@ page import="java.sql.*" %> <% String vemp_code=request.getParameter("emp_code"); String vemp_name=request.getParameter("emp_name"); Connection conn = null; ResultSet rs=null; String url = "jdbc:mysql://localhost:3306/"; String driverName = "com.mysql.jdbc.Driver"; String userName = "roor"; String password = "root"; try{ Class.forName(driverName).newInstance(); conn = DriverManager.getConnection("jdbc:mysql://localhost/niree",userName,password); Statement stmt = conn.createStatement(); stmt.executeUpdate("use newuser;"); out.println(" connection is established"); //Statement stmt = conn.createStatement(); //int val = //stmt.executeUpdate("INSERT employe VALUES(?,?)"); PreparedStatement pst; pst=conn.prepareStatement(" insert into employe values(?,?)"); pst.setString(1,vemp_code); pst.setString(2,vemp_name); } catch(Exception e){ System.out.println("error occured"); e.printStackTrace(); } %>
Last edited by peter_budo : Apr 4th, 2008 at 2:12 pm. Reason: Keep It Organized - please use [code] tags
Don't write database connectivity code in a JSP; that's not what JSP's were meant for. Push all that database logic inside a servlet. Use JSP only as a presentation technology.
And BTW, have you hosted your files on the Tomcat server? What is the URL you are using to access your HTML? What kind of error do you get? Aren't the error logs useful?
And BTW, have you hosted your files on the Tomcat server? What is the URL you are using to access your HTML? What kind of error do you get? Aren't the error logs useful?
I don't accept change. I don't deserve to live.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
•
•
Join Date: Nov 2004
Location: Netherlands
Posts: 5,752
Reputation:
Rep Power: 18
Solved Threads: 199
#
String userName = "roor";
#
String password = "root";
i think you should take care of Name
check it plase it should be ROOT not ROOR
String userName = "roor";
#
String password = "root";
i think you should take care of Name
check it plase it should be ROOT not ROOR
Mahmoud Rizk
002-010 4411 540
Admin@ErpEgypt.com
Internet Marketing Consultant - Sales and Marketing Certified.
002-010 4411 540
Admin@ErpEgypt.com
Internet Marketing Consultant - Sales and Marketing Certified.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- How to Connect MySQL from JSP Page (JSP)
- how to update database using mysql and jsp (JSP)
- Inserting uft8 strings into MySQL from jsp page (JSP)
- Cant get a free web host for JSP & MYSQL (JSP)
- Problem connecting my Tomcat Server and MySQL using JSP (JSP)
Other Threads in the JSP Forum
- Previous Thread: Jsp doesnt work while source code of it that runned from Html does Work perfect. Why?
- Next Thread: Window close event in safari



and, this line is missing
Linear Mode