Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa HTML code for jsp to db connection using jdbc

Have Programming Question? Ask it here!
 
 
 


anjali pathuri
code for jsp to db connection using jdbc
4 Answer(s)      3 years and 4 months ago
Posted in : HTML


please send me the code


Advertisement
View Answers

December 6, 2010 at 12:35 PM


Hi Friend,

Try the following code:

1)form.html:

<html>
<form method="post" action="http://localhost:8080/examples/jsp/insert.jsp">
<table>
<tr><td>Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>

2)insert.jsp:

<%@page import="java.sql.*"%>
<%
String name=request.getParameter("name");
String address=request.getParameter("address");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
           Connection con = DriverManager.getConnection("jdbc:odbc:student");
           Statement st=con.createStatement();
           int i=st.executeUpdate("insert into user(name,address) values('"+name+"','"+address+"')");
           out.println("Data is inserted successfully");
%>

Thanks



May 6, 2013 at 9:10 PM


('"+name+"','"+address+"')"); here i m getting problem... it shows error... that 'operator + can not be applied to java.lang.String,name can not find symbol.... plzz help me...



May 8, 2013 at 12:57 PM


the insert.jsp code is not working... Becoz of there is no try catch block.... <%@page import="java.sql.*"%> is not enough.. it shud be

<%@ page language="java" import="java.sql.,java.util.,java.text.*" %>

--Rohit Soni



November 27, 2013 at 2:19 PM


Thank You Very much Miss anjali pathuri for this code:

I have included Try-Catch Block in insert.jsp Page

<%@page import="java.sql.*"%>
<%
String name=request.getParameter("name");
String address=request.getParameter("address");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student","sa","password0");
Statement st=con.createStatement();
st.executeUpdate("insert into users(name,address) values('"+name+"','"+address+"')");
out.println("Data is inserted successfully");
}
catch(Exception ex)
{
out.println(ex.getMessage());
}
%>



Related Tutorials/Questions & Answers:
code for jsp to db connection using jdbc
code for jsp to db connection using jdbc  please send me the code   Hi Friend, Try the following code: 1)form.html: <html> <...("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc
Server DB connection - JDBC
get it to work. If you have any sample code for getting connection please...Server DB connection  Hello Guys I want to connect two databases at the same time but it looks like the java is only picking up the second database
Advertisements
JDBC Connection code to connect servlet with oracle.
JDBC Connection code to connect servlet with oracle.  JDBC Connection code to connect servlet with oracle
jdbc connection to java program code - JDBC
jdbc connection to java program code  i want a simple java program that which communicates with oracle database like creating table,insert values and update records in database and show in program output? please take a simple
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.  please provide online quiz program coding using jsp, jdbc...").newInstance(); Connection connection = DriverManager.getConnection("jdbc:mysql
upload csv to mysql db using jsp upload
upload csv to mysql db using jsp upload  Hello all, Please give me the code to uplad .csv from jsp page and insert values into MySQl db. I have a table with 8 cloumns.(MDN--varchar(30),Otafdate date,crt varchar(30),dmdn
JDBC connection
we illustrates you JDBC url connection. The current Tutorial helps you to understand JDBC connection. The code explains you   how... JDBC connection       The JDBC
Draw graph using jsp without database connection
Draw graph using jsp without database connection  Draw graph using jsp code without database connection
How to insert data from a combobox and textbox values into DB using JSP?
How to insert data from a combobox and textbox values into DB using JSP?  hi, How to insert a comb-box and a text box values in to DB using JSP? @DB... and textbox2? into MYSQL DB
javax. servlet.Servlet Exception: Initialization failed, Unable to get DB connection - JSP-Servlet
ServletException("Initialization failed, Unable to get DB connection...javax. servlet.Servlet Exception: Initialization failed, Unable to get DB connection  Hi.i am beginner. using eclipse. i am sure my deployment
JSP,DB
"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test...JSP,DB  How to store the resultset of a query in a hashtable n retrive it into a jsp textfield!!!!!! datatable Label value id applno
jdbc connection
"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://127.0.0.1...jdbc connection  How to Submit data????   <%-- view jsp --%> <%@page import="java.sql.Statement"%> <%@page import
JDBC Connection code to connect servlet with SQL Server 2008
JDBC Connection code to connect servlet with SQL Server 2008  Please... support for JDBC 4.0. i try Avery thing but i m not success so please ans me . My connection code is static Connection con; static Statement st; static
Todd oracle DB connection through PHP
Todd oracle DB connection through PHP  Can u please explain how to connect Todd oracle DB using PHP & What are the setups we need to perform? Thanks
How to get data from DB in to Text box by using Jsp & Ajax
How to get data from DB in to Text box by using Jsp & Ajax   I want to get the data from database in to text box in a jsp page by using Ajax. If I enter the letter A in the textbox it should show only those values which starts
jsp to cassandra datbase connection by using eclipse
jsp to cassandra datbase connection by using eclipse  sir i want to connect the apache cassandra datbase by using cql query language. i am success by using simple java application.now my task is to interact with cassandra
How to design https connection page using JSP
How to design https connection page using JSP  Hi, I have a project... a secure page. Please kindly provide me a solution on how to design a https page using JSP Thank you
connection - JDBC
connection  how to connect server pages to mysql  Hi Friend, To learn how to connect MySql to JSP, please visit the following link: http://www.roseindia.net/jsp/connect-jsp-mysql.shtml Thanks
JDBC connection
JDBC connection  ![alt text][1]I got exception in Connecting to a MySQL Database in Java. The exception is ClassNotFoundException:com.mysql.jdbc.Driver wat is the problem
tree using jsp code
tree using jsp code  i want to draw a tree structure of a family hierarchy using jsp code
JDBC connection and SQL Query - JDBC
JDBC connection and SQL Query  Hi, I'm reading a all files one... DB. But I'm trying hard to figure out syntax for inserting into a table using...]. In short I read values in array of temp, and I need to insert into DB using those
JSP,DB,SERVLET
JSP,DB,SERVLET  hi thank you for your reply.With this code i can... the code for the same scenario using for populating data into database through..."); Connection con = DriverManager.getConnection("jdbc:odbc:student
online shopping code using jsp
online shopping code using jsp  plz send me the code of online shopping using jsp or jdbc or servlets plz plz help me
jdbc connection issues
tables with only one jdbc connection program...if possiable pls post a sample code...jdbc connection issues  Hello. kindly pls help in this issue...i have created 11 jsp form wit some attributs in it also created 11 tables
JDBC connection pooling
JDBC connection pooling  What is Connection pooling
Java-Connection Pool - JDBC
= "jdbc:mysql://localhost:3306/"; String db = "register"...Java-Connection Pool  How can I create a connection pool. My database... is Weblogic 8. Which is the best approach to create a connection pool? 
j2me jdbc connection - JDBC
j2me jdbc connection  hello, whn i m importing sql package in mine midlet(tried for both javax.sql.* and java.sql.*;)..itz nt accepting it... hw to get connected to database?????.... plz help me out
JSP,DB,SERVLET
JSP,DB,SERVLET  hi thank you for your reply.With this code i can..."); Connection con = DriverManager.getConnection("jdbc:odbc:student"); Statement st..."); Connection con = DriverManager.getConnection("jdbc:odbc:student
JDBC connection timeout
The code include a class JDBC Connection Timeout, inside the main method we include... JDBC connection timeout       The Tutorial describe you a JDBC Connection timeout. In this program, we
Connection to jdbc - Java Beginners
Connection to jdbc  I need to populate a listbox in jsp with values from Postgresql JDBC. i used the following code... but its not working... can..., We have used Mysql database. Try the following code
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
code to establish jdbc database connectivity in jsp
code to establish jdbc database connectivity in jsp  Dear sir, i'm in need of code and procedure to establish jdbc connectivity in jsp
java connecting to oracle db - JDBC
to use: Connection conn = DriverManager.getConnection("jdbc:oracle:oci8... have to use: Connection conn = DriverManager.getConnection ("jdbc:oracle:thin...()); Connection conn = DriverManager.getConnection("jdbc:oracle:thin: @localhost
Jdbc Mysql Connection Url
JDBC Mysql Connection Url       The Tutorial want to illustrate a code that explain you to understand JDBC Mysql Connection. In this program, the code explain the JDBC url and string
JSP,DB,SERVLET
JSP,DB,SERVLET  I have a jsp page called page1.jsp with 3 text fields... (page1servlet.java) and bean(page1bean.java).I have another jsp page(display.jsp... not populate the datas automatically from databse in jsp on entering name ...can u
JSP,DB,SERVLET
JSP,DB,SERVLET  I have a jsp page with 3 text fields name,age ,city.i populated these datas into a database table.I have another jsp page with 4... be automatically populated from database throush servlet..Can u give me the code
Java jdbc connection
Java jdbc connection  Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection
HTML code to servlet to database using jdbc
HTML code to servlet to database using jdbc  pls send me the code related to the title   Hi Friend, Try the following code: 1)form.html... { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con
JDBC Connection Pool
database connection in resource pool. You can make your own code for JDBC...JDBC Connection Pool In this section we will learn about JDBC Connection Pool... application will give you improved performance if you use the JDBC Connection
how to insert, retrieve data from,to db(code)....
that data will b stored in db(m using sybase). 2.also hw to retrieve the data from db. cn u plz tel me the code in detail.n i thk it shud b written in jdbc...how to insert, retrieve data from,to db(code)....  Hi..... i ve
Java Jdbc connection
Java Jdbc connection  What are the steps involved for making a connection with a database or how do you connect to a database
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript
that is retrieved from MySQL DB using jsp,jstl,javascript  when click on the next...://www.roseindia.net/jsp/navigation-database-table.shtml   follow this code..._name where id=..; database:mysql technology:jsp,servlet,javascript,jstl  
connection with xslx - JDBC
connection with xslx  hai to all i am not able to connecting to xlsx(2007 excel file) using jdbc?please help me?  Hi Friend, Please visit the following links: http://www.roseindia.net/tutorial/java/poi
Connection using Jdbc-odbc bridge Driver
Connection using JDBC-ODBC bridge driver JDBCExample.java...;); --In the above code, connection class object 'con' is used by DriverManager... connection. Statement st = con.createStatement(); --In this code line ,we create
jsp fie execution in tomcat and using mysql - JDBC
jsp fie execution in tomcat and using mysql  I created 2 jsp files..., There is a problem in both JSP pages. If you want to login,try the following code: 1... that we used in the JDBC Connection are the MySql username and password.The
jdbc odbc connection
jdbc odbc connection  i need a program in java which uses a jdbc odbc connection   Hi, You can create odbc datasource on your windows computer and then access in your Java program. Read the JDBC ODBC example. Thanks
JDBC Connection and Registration
JDBC Connection and Registration   How to create a JDBC connection... your java with jdbc code.. It will create table in MS access database. Here..... :-)   JDBC MS Access Database Connectivity: Follow these steps: 1)Go
connection pooling - JDBC
. In JDBC connection pool, a pool of Connection objects is created...++) { gObjPool.addObject(); } Connection connection = java.sql.DriverManager.getConnection("jdbc...connection pooling  how to manage connection pooling?   Hi
how to insert, retrieve data from,to db(code)....
how to insert, retrieve data from,to db(code)....  Hi, i have created... will b stored in db(m using sybase). 2.also hw to retrieve the data from db. cn u plz tel me the code in detail.n i thk it shud b written in jdbc.....i ve
java database connection - JDBC
so..  Hi Friend, We are providing you a code that will insert...{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection connect =DriverManager.getConnection("jdbc:odbc:access"); pstm=connect.prepareStatement("insert into data
Advertisements
 

 

 

DMCA.com