Home Answers Viewqa JDBC to store form vaues in database

 
 


vijay
to store form vaues in database
1 Answer(s)      4 years and 8 months ago
Posted in : JDBC

View Answers

October 17, 2008 at 4:16 PM


Hi friend,



Code to insert the data into database :

<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %> 

<HTML>
<HEAD>
<TITLE>Navigating in a Database Table </TITLE>
</HEAD>

<BODY bgcolor="#ffffcc">
<font size="+3" color="green"><br>Welcome in www.roseindia.net !</font>
<FORM action="" method="post">
<TABLE style="background-color: #ECE5B6;" WIDTH="30%" >

<TR>
<TH width="50%">Name</TH>
<TD width="50%"><INPUT TYPE="text" NAME="name"></TD>
</tr>
<TR>
<TH width="50%">Father Name</TH>
<TD width="50%"><INPUT TYPE="text" NAME="father_Name"></TD>
</tr>

<TR>
<TH></TH>
<TD width="50%"><INPUT TYPE="submit" VALUE="submit"></TD>
</tr>
</TABLE>
<%
String name = request.getParameter("name");
String father_Name = request.getParameter("father_Name");



/* Create string of connection url within specified format with machine name,
port number and database name. Here machine name id localhost and database name is student. */
String connectionURL = "jdbc:mysql://localhost:3306/student";;

// declare a connection by using Connection interface
Connection connection = null;

// declare object of Statement interface that uses for executing sql statements.
PreparedStatement pstatement = null;

// Load JBBC driver "com.mysql.jdbc.Driver"

int updateQuery = 0;

// check if the text box is empty
if(name!=null && father_Name!=null ){

// check if the text box having only blank spaces
if(name!="" && father_Name!="") {

try {

Class.forName("com.mysql.jdbc.Driver").newInstance();

/* Create a connection by using getConnection() method that takes
parameters of string type connection url, user name and password to connect
to database. */
connection = DriverManager.getConnection(connectionURL, "root", "root");

// sql query to insert values in the secified table.
String queryString = "INSERT INTO stu_info(Name,Father_Name) VALUES (?, ?)";

System.out.println("queryString : " + queryString);
/* createStatement() is used for create statement object that is used for
sending sql statements to the specified database. */
pstatement = connection.prepareStatement(queryString);
pstatement.setString(1, name);
pstatement.setString(2, father_Name);
updateQuery = pstatement.executeUpdate();

if (updateQuery != 0) { %>
<br>
<TABLE style="background-color: #E3E4FA;" WIDTH="30%" border="1">
<tr><th>Data is inserted successfully in database.</th></tr>
</table>
<%
}
}
catch (Exception ex) {
out.println(ex.getMessage());

}
finally {
// close all the connections.
pstatement.close();
connection.close();
}
}
}
%>
</FORM>
</body>
</html>

For more information visit to :

http://www.roseindia.net/



Thanks









Related Pages:
to store form vaues in database - JDBC
to store form vaues in database  sir i have created one form with two... the code   Hi friend, Code to insert the data into database :   Navigating in a Database Table Welcome
send multiple textbox vaues in to an jsp form to store them in a DB table
send multiple textbox vaues in to an jsp form to store them in a DB table ... values in to an jsp file with additional values to store those values in to an database table. Please help me...... looking forward to hear from you
Need Solution to get vaues from sql database in java
Need Solution to get vaues from sql database in java  hi I have... need to get values from sql database for values in the blank field(" "). how do i get these values.. already connected database and created xml tags in separate
Solution to get vaues for xml tags fform sql database in java
Solution to get vaues for xml tags fform sql database in java  hi I...; now i need to get values from sql database for values in the blank field(" "). how do i get these values.. already connected database and created xml tags
How to store JComboBox item into database
How to store JComboBox item into database   import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import...(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("DETAIL FORM
store values of drop down list box in database
store values of drop down list box in database  how to store values of drop down list box in oracle database in jsp?I have information inserting form where i have date of birth as drop down list box
Store values of dynamically generated textboxes into database
Store values of dynamically generated textboxes into database   I'm trying to create a form where the user gives number to generate textboxes. when... it to be saved in MYSQL database. Anybody please help me
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
how to store image upload path to mssql database
how to store image upload path to mssql database  hi there!!, i need help in storing the image upload path into the database. basically i just use file select to upload the image from jsp to database. however when i click submit
store current system date in to database - Development process
store current system date in to database  Hi,this is my code . here iwant to store current system date in to database and want to store subdept..."); function change(combo1){ var comboValue = combo1.value; document.forms["form
store form data into word document
store form data into word document  i want form page data, ex username phone number.. to store it in a word document file
How to store image into database
How to store image into database  Hi, all I want to store image into database using Java. Can anyone help me that how can i store image into database using Java. Thanks in advance.   hi friend, To store image
How I Upload File and Store that file name in Database using JSP
How I Upload File and Store that file name in Database using JSP  Hi All, I m the beginner in JSP and I want to upload the file and store that file and some other form data in MySQL database. Ex. There is one employee detail
image store in database - JDBC
to store image into database. Check at http://www.roseindia.net/servlets/insert...image store in database  Dear Deepak Sir, If I want to store image into the database what is the process to do that? Please explain
How to store an image in database
How to store an image in database  Hi........... How to store an image in postgresql using a query. I mean tell me the way to store an image using datatype. I am using the datatype bytea but tell me how to insert the image
store pagination form fields - Struts
store pagination form fields   hi,iam working online exams project . my intention is to save data that has been asnwered by client/student into db table. here iam using pagination for questions to be displayed to client
Database
Database  Hi, i need help building a database based on something like video store rentals, online shopping orders. Help would be appreciated. I...), multiplicity (or cardinality), in the context of the database system (i.e. give
to store data entered in html page
to store data entered in html page  i want to a job site, in this site user can registered by a form.. in this form there are his information... i...,reset and submit botton in form 1 after entering username and password by clicking
store and retrive image from the database
to store and retreive images from sql database using sql commands -how to store and retreive images from sql database using asp.net/c# thanks in advance...store and retrive image from the database  please provide me
Store XML file into Sqlserver Database
Store XML file into Sqlserver Database  Code for storing a typical XML file into SQl server database in 1 or more tables using asp.net using C
Batchwise Store
Batchwise Store  i want to read the column from excel and store the data as batchwise into database
How to store multiple images in folder and images path in database at a time using jsp?
How to store multiple images in folder and images path in database at a time using jsp?  I wanna browse multiple images in one form and store them in one folder and their path into datrabase
How to save form fields into the MySql Database without submit button in jsp?
How to save form fields into the MySql Database without submit button in jsp?  I want to store user inputs into the database using javasccript or ajax or jqury but without submit button. Form Contains three fields
store dropdown box values in database server
store dropdown box values in database server  how to store dropdown box values in database server in jsp
Store XML file into Sqlserver Database
Store XML file into Sqlserver Database  Code for storing a typical XML file into SQl server database in 1 or more tables using asp.net using C#. <?xml version="1.0" ?> <!DOCTYPE PubmedArticleSet (View Source
Write a program to get student details and store in a database
Write a program to get student details and store in a database  Write a program to get student details and store in a database
Jsp Code to store date in database - JSP-Servlet
Jsp Code to store date in database   Hi, Can u give me jsp code to store current date in to database. Thanks Prakash
store dynamic generated textbox value into database
store dynamic generated textbox value into database  sir, how do i store dynamically generated textbox value into the database thanks in advance
how to store and then immediately retrieve when store the image into database?
how to store and then immediately retrieve when store the image into database?  how to store and then immediately retrieve when store the image into database?   Here is a jsp code that insert and retrieve image from
store & retrive the image from oracle database
store & retrive the image from oracle database  how can i store the image path in tha database & fetch that image from oracle database
how to store multiple values from drop down in database where i am using java struts 1.3
how to store multiple values from drop down in database where i am using java struts 1.3  hii, i am coding a form where i need a keyskills attribute where i have to select multiple keyskills. but it is taking only one valuee.. i
for store data in data base - JSP-Servlet
.. and on 3rd form i use submit button... data of form 1 and 2 can also be store...for store data in data base  i want to a job site, in this site user can registered by a form.. in this form there are his information... i use
check box realtive information in page store in database
in page store in database plz help me...check box realtive information in page store in database  check box relative information in page store in database  hiiiiiiiii, Que I
upload file to server and store recode in database
upload file to server and store recode in database  i want to upload a file into the server and store a recode in mysql database.any one know the code
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir... to store that data in int variable. how to do this ?   Here is an example that retrieve the integer values from the database and stored in the integer
store and retrive image from database - JDBC
store and retrive image from database  how to store and retrive an image in database using java?  Hi friend, Code for store image in database using Java. import java.sql.*; import java.io.*; public class
how to store and retrieve image from database
how to store and retrieve image from database  how to store and retrieve images into database(oracle) and how to retrive images from database using... database. <%@page import="java.sql.*,java.io.*"%> <% try{ InputStream
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
How to store extracted values from xml in a database? - XML
How to store extracted values from xml in a database?  I want to store extracted xml values in a database... How can i store extacted xml values in a database... give me a example
To store date - JSP-Servlet
.....   Hi friend, Code to store date in database...To store date  Hai friends, I want the format to store date in database MySQL. But, date object returns day, month, and year in integer
how can i store text box values as it is in database table
how can i store text box values as it is in database table  CUSTOMER DESCRIPTION
Java Xml Data Store
be followed up and/or purchased. You will need to store the data in a local binary... the implementation needs to change later on (perhaps they might decide to store the data in an existing database
DATABASE
DATABASE  I can't send different information from different form into a single table in my database
How to store values in a database using JSTL? - JSP-Servlet
How to store values in a database using JSTL?  I want to store values in a database... How can i store in database? Here is my code... This wil extract details and displays in a table format... Now i want to store these values
how to store and retrieve images int and from the database using php
how to store and retrieve images int and from the database using php  please anyone can help me in storing the images and retrieve it back from the Mysql database using php
store
store  i want to store data in (.dat) file format using swing and perform operation on that insertion,deletion and update
To store value in session & display it
To store value in session & display it  Hello..I m trying to run the following code which will store the session of a book selected on click...; <body> <form action="/Books/addtocart" target
store
store  hi i want store some information in my program and use them in other method. what shoud i do

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.