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

 
 


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

Storing Data, Datatype vale in SQL

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 Pages:
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
sorting and storing data
sorting and storing data   sorting and storing data in UITableView
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
iphone storing and fetching data
iphone storing and fetching data  How to store and fetch data in an iphone application
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
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
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
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
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 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
Mysql Alter Column Datatype
Mysql Alter Column Datatype       Mysql Alter Column Datatype is used to modify the table and change the datatype of field. Understand with Example The Tutorial illustrate an example
storing csv into oracle database
storing csv into oracle database  i want jsp code for storing csv file into oracle database
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
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
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
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
Uploading a Software and storing in the database
Uploading a Software and storing in the database  I want to upload a software(may be of maximum 20mb) through JSP, and store it in the database. The coding present in the site for uploading and storing in the database
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
storing xml into database - XML
storing xml into database   hi i have an xml file it contains elements with attributes as well as nested elements so how to go forward .......with it i know how to persist a simple xml file into data base but i m finding some
fetching data using servlets - SQL
fetching data using servlets  I have successfully made connection with the oracle10g database that i am using and also able to put in data using JSP...-jsp-data-list.shtml Hope that it will be helpful for you. Thanks
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
delete data from database - SQL
delete data from database  HOw to delete specific data from table> I want to delete one record from database. Thnx  Hi friend.... http://www.roseindia.net/jsp/user-search.shtml Thanks
correct the sql error and retrive data....plez
correct the sql error and retrive data....plez  i am getting a SQL Error while retriving data from access to jframe called "datatype mismatch in criteria expression" plez do help me and studentId's datatye is number
sql exception - JSP-Servlet
sql exception  Dear sir , I am working in a web-based project, In my system it is working fine but at client side getting the following...: no data passed to obfuscation toolkit ORA-06512: at "SYS.DBMS_OBFUSCATION_TOOLKIT
SQL
SQL  hii What is sql?   hello, SQL, which stands for Structured Query Language, is a special-purpose language used to define, access, and manipulate data. SQL is non procedural, meaning that it describes
sql/xml query in jsp - JSP-Servlet
sql/xml query in jsp  Sir I am coding in jsp and trying to retrieve xml data from db2 using sql/xml query in jsp but getting no result. When running jsp file in browser the output
convert data format sql
convert data format sql  convert data format sql
Datatype convertion
Datatype convertion  it possible to convert long datatype into string in java if possible means how
SQL
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM
SQL
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM
Boolean DataType
Boolean DataType  What is the Size of the Boolean datatype in Java
JSP data base validation
JSP data base validation  please explain how to validate form input string with database n also how its notify that entered data exists already...("sName"); String phno = request.getParameter("phno"); String sql = "insert
SQL
SQL Trigger query  Why we use the Trigger and what it's uses?  ... restrict access to specific data, perform logging, or audit data modifications... replicates 7)Gather statistics on table access 8)Modify table data when DML
SQL
restrict access to specific data, perform logging, or audit data modifications... table replicates 7)Gather statistics on table access 8)Modify table data when DML... events, user events, and SQL statements to subscribing applications 10)Restrict DML
SQL
access to specific data, perform logging, or audit data modifications. Triggers... replicates 7)Gather statistics on table access 8)Modify table data when DML... events, and SQL statements to subscribing applications 10)Restrict DML
SQL
restrict access to specific data, perform logging, or audit data modifications... table replicates 7)Gather statistics on table access 8)Modify table data when DML..., user events, and SQL statements to subscribing applications 10)Restrict DML
Storing content from file path to an array
Storing content from file path to an array  Hi, I have a path for e.g. /Lecture/Materials/CGR/Revision/Animation.txt which is stored in my HBase. I... the contents in this text file to an array. I am using jsp. I can access my path but how
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
SQL
the data and the same has to be updated in the second application But the second application failed to update the data. How will you sync the data between these two
SQL
SQL  what data type we use for the uploading the video and image files in MySQL server 2008
sql/xml query in jsp - JSP-Servlet
sql/xml query in jsp  Sir Here is my code which is not working Testing JSP select id from "SYSTEM..." name:PROFILE columns:id (bigint) and INFO (xml) data stored:id=1 and info=nitin
jsp page connectivity with oracle - SQL
jsp page connectivity with oracle  I am unable to database connectivity jsp with oracle. Please send the code for solving problem. thanks ... * from data"); 5) Close the statement,resultset and connection: rs.close
complex xml parsing and storing in database - XML
complex xml parsing and storing in database  Hi Experts ,i want to parse my xml document and store it in mysql database. This is my code. How to parse this complex data. EDI_DC40 800 0000000000557748
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
How to use sum sql query to process the summed data into a list?
How to use sum sql query to process the summed data into a list?  Im get stuck to get sum of data in database. Then i need to list the summed of data in jsp page. For example, i have a database named family that store
How to use sum sql query to process the summed data into a list?
How to use sum sql query to process the summed data into a list?  Im get stuck to get sum of data in database. Then i need to list the summed of data in jsp page. For example, i have a database named family that store
for store data in data base - JSP-Servlet
for store data in data base  i want to a job site, in this site user..... and on 3rd form i use submit button... data of form 1 and 2 can also be store in table along with 3 form.. how can i do it... i use sql server2000  Hi
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 Date
SQL Date       The SQL Date is used when you are working with dates. This include the format of data ,the insert value matches the format of the data column 

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.