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



Home Answers Viewqa JDBC JSP Storing Data, Datatype vale in SQL
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


effert
JSP Storing Data, Datatype vale in SQL
3 Answer(s)      6 years and 9 months ago
Posted in : JDBC


Storing Data, Datatype vale in SQL


Advertisement
View Answers

February 28, 2008 at 2:54 PM


Storing Data, Datatype vale in SQL

<html>

<head>
<title>Current Date Insert value in database</title>
</head>

<body>

<table border="1" width="50%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<h1><center>Current Date Insert value in Database</center></h1>
<form method="POST" action="InsertAction.jsp">

<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="right"><b>Name:</b></td>
<td width="50%"><input type="text" name="username" size="30"></td>
</tr>
<tr>
<td width="50%" valign="right"><b>Job-Position:</b></td>
<td width="50%"><input type="text" name="jobposition" size="30"></td>
</tr>
<tr>
<td width="50%" valign="right">&nbsp;</td>
<td width="50%" valign="right">&nbsp;</td>
</tr>
</table>
<p><input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2"></p>
</form>
</td>
</tr>
</table>
</body>
</html>




Actionpage

InsertAction.jsp


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

<%

Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "register";
String driver = "com.mysql.jdbc.Driver";
java.util.Date date;
String s=null;
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"root","root");
try{
Statement st = con.createStatement();
String username=request.getParameter("username");
String jobposition=request.getParameter("jobposition");
DateFormat dformat = new SimpleDateFormat("yyyy-MM-dd");

try{
date = new java.util.Date();
s = dformat.format(date);
System.out.println("Today = " + s);
}
catch(Exception e){
e.getMessage();
}
int val = st.executeUpdate("insert user_details values('"+username+"','"+jobposition+"','"+s+"')");
con.close();
out.println("success");
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>


February 28, 2008 at 2:59 PM


Above given program, will help you in storing date in sql database.

See how to insert data from html to sql database using JSP and Servlet here...
http://www.roseindia.net/answers/viewanswers/272.html



March 3, 2008 at 4:37 PM


Thank you for ur help


Related Tutorials/Questions & Answers:
sorting and storing data
sorting and storing data   sorting and storing data in UITableView
iphone storing and fetching data
iphone storing and fetching data  How to store and fetch data in an iphone application
Advertisements
Storing and retrieving data alongwith image in mysql db using jsp
Storing and retrieving data alongwith image in mysql db using jsp  I want to store and retrieve the whole data as shown below in mysql db. I've put in my all efforts for building this jsp but I'm not able to understand where's
Produces XML file but format not correct for storing data using JSP and XML
Produces XML file but format not correct for storing data using JSP and XML  hii I have created a project using JSP and XML as database to store data entered by user in XML file ,It stores data entered in XML file
Storing and Reading data
Storing and Reading data   Hello, I'm developing a GUI application as part of an assignment but stuck on how my program stores and reads the data... that limits the data type and the character size that can be entered
storing data into flat files
storing data into flat files  how can i retrive data from database and store data in flat files   Hi Friend, Try the following code: import java.io.*; import java.sql.*; import java.util.*; class StoreDataIntoFile
storing data in xml - XML
storing data in xml  Can u plz help me how to store data in xml using java  Hi Friend, Try the following code: import java.io.*; import java.util.*; import org.w3c.dom.*; import javax.xml.parsers.*; import
how to use float datatype in mysql? - SQL
how to use float datatype in mysql?  how to use float datatype in mysql?  hi Chitra this code help u CREATE TABLE `paging` ( `Id` float(10,2) NOT NULL default '0.00', `name` varchar(255) default NULL
Storing Multiple image in sql using java
Storing Multiple image in sql using java  Hi, How to store and retrieve a multiple image in sql using java but already i have created sql table if i want to insert a image while runtime execution. Can anyone tell me solution
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
jsp code for storing login and logout time to an account
jsp code for storing login and logout time to an account  I need simple jsp code for extracting and storing login and logout time in a database table...://www.roseindia.net/jsp/loginstatus.shtml
data fecth from data base in( sql 2000) htmlform and jsp
data fecth from data base in( sql 2000) htmlform and jsp  hi iam using jsp and html form data fecth from database display the textbox help me i want whenever select from dropdown list select the projectname to display
getting and storing dropdown list in database in jsp
getting and storing dropdown list in database in jsp  i have a drop... into data(language) values('"+selectedValue+"')"); out.println("Data... lyk this. but it storing null value in the database. :\ what to do
jsp - JDBC
JSP Storing Data, Datatype vale in SQL   Storing Data, Datatype vale in SQL   Storing Data, Datatype vale in SQL <html><head>..., will help you in storing date in sql database.See how to insert data from html
storing details in database on clicking submit button - JSP-Servlet
storing details in database on clicking submit button  I am using JSP......Tell me where an what code should I write to store the values in data base table? JSP Page Name
convert data format sql
convert data format sql  convert data format sql
SQL Decimal
SQL Decimal       SQL Decimal is used to specify the values in decimal datatype. The Decimal datatype... point (p,s). The DECIMAL data type can store decimal floating-point numbers up
Datatype convertion
Datatype convertion  it possible to convert long datatype into string in java if possible means how
Boolean DataType
Boolean DataType  What is the Size of the Boolean datatype in Java
Data Conversion In Sql Server 2005
Data Conversion In Sql Server 2005  Hi I am working vb.net & sql server 2005 database. I am storing date (MM/DD/YYYY) format. now I have problem in sql date conversion (DD/MM/YYYY). Can you help how to convert date
Mysql nchar Datatype
Mysql nchar Datatype       MySQL nchar define the datatype nchar that stores fixed-length character data. The data can be a string single-byte or multibyte letters, digits
Transfer Data to Sql Database
Transfer Data to Sql Database  Hey guys, how to Transfer data to SQl database using Java? Transfer data already stored in excel to Sql databse using Java? Looking for an easier method so i can comprehend
Java Datatype
Java Datatype  What will be the output of following java program and why? class Datatype{ public static void main(String[] args.... Therefore it displays its corresponding integer value. class Datatype{ public
Java Datatype
Java Datatype  What will be the output of following java program and why? class Datatype{ public static void main(String[] args.... Therefore it displays its corresponding integer value. class Datatype{ public
SQL and JSP
using sql data base.. 2.JSP pages 1.login screen which will have user id...SQL and JSP  1.sql database 1.store login and password details... with the data is backend(data base)..if match found,then opehs next page or else show
Inserting Data into mysql - SQL
Inserting Data into mysql  My sincere apologize for this post. I noticed there is no category for php. However am hoping my question will fit into the SQL category though under php. I need help with reading from a csv file
Import Data to SQL database in Java
Import Data to SQL database in Java  Hi, I'm a beginner and I'm wondering how to Import Data to SQL database in Java? Thanks (Platform: Eclipse/SQL
data copy - SQL
data copy   how to copy values of one column from one table into another column of another table?  Hi INSERT INTO table_name (column_name) AS SELECT DISTINCT VALUES FROM table_name (column_name
jsp -sql - JSP-Servlet
jsp -sql  Hello Sir/Madam, Please send me the error in the following sql code if any. I did not get any error message and iam not getting... by entrydate" What is the data type of "entrydate" if "entrydate" is Date type
retriving data from sql server using jsp code and placing them in text fields of html code
retriving data from sql server using jsp code and placing them in text fields of html code  Hi, my question is how to retrieve data from sql server 2008 using a jsp file and place the values in the text fields of a html file
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.  <html> <..."> <title>JSP Page</title> <style type
 

 

 

DMCA.com