Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JSP
Search Coderanch
Advance search
Google search
Register / Login
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JSP
Unable to insert values in database from jsp
rajnish patel
Ranch Hand
Posts: 56
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I want to enter data in database entered from
jsp
file and dont know how to connect them.
can any one help me to connect both files and to add the data entered in jsp form ??
this are my jsp and
java
files
test1.java
package P1; import java.sql.*; class test1 { public static void main(String[] args) throws SQLException, ClassNotFoundException { Connection con = null; try { Class.forName("oracle.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ex) { System.out.println("Error: unable to load driver class!"); System.exit(1); } con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.106.87:1521:ORA11G","fuel_db","foel"); Statement statement = con.createStatement(); String command = "INSERT INTO student (name, rollno, class, mobileno) VALUES (?, ?, ?, ?);"; statement.executeUpdate(command); con.close(); } }
test1.jsp
package P1; import java.sql.*; class test1 { public static void main(String[] args) throws SQLException, ClassNotFoundException { Connection con = null; try { Class.forName("oracle.jdbc.odbc.JdbcOdbcDriver"); } catch(ClassNotFoundException ex) { System.out.println("Error: unable to load driver class!"); System.exit(1); } con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.106.87:1521:ORA11G","fuel_db","foel"); Statement statement = con.createStatement(); String command = "INSERT INTO student (name, rollno, class, mobileno) VALUES (?, ?, ?, ?);"; statement.executeUpdate(command); con.close(); } }
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please continue any discussion in your original post for this question.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to Comparing user inputs received with data stored in microsoft database tables
not retreiving from db
Help- unable to connect to MySQL Connector/J
Not able to use ResultSet properly
Unable to insert values in database
More...