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



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

Have Programming Question? Ask it here!
 
 
 


effert
JSP Storing Data, Datatype vale in SQL
3 Answer(s)      6 years and 5 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
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
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
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
Boolean DataType
Boolean DataType  What is the Size of the Boolean datatype in Java
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
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
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
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
storing csv into oracle database
storing csv into oracle database  i want jsp code for storing csv file into oracle database
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
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
Java Primitive Datatype
Java Primitive Datatype  what is the size of boolean datatype ? please explain in detail
Data types in Oracle 9i - SQL
Data types in Oracle 9i  Cn anyone tell me the difference between timestamp wih time zone and timestamp with local timezone datatypes in oracle 9i.  Hi Friend, On Using TIMESTAMP WITH TIME ZONE, oracle store timezone
insert and retrive data and time - SQL
insert and retrive data and time  hello everybody . Is there any method in java so that we can insert current system time and then it can be retrieve that date and time from database ? ..........................  
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
Writing a trigger for an userdefined datatype
Writing a trigger for an userdefined datatype  i have a user defined datatype in EMP table like COLUMNNAME:ADDRS_TYPE where ADDRS_TYPE have the following columns DATATYPE :ADDRESS VARCHAR2(136) V_CODE VARCHAR2(8) T_CODE
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
datatype - Java Beginners
datatype  how i convert char datatype in string format for ex.(convertion of int datatype) int variable_name=Integer.parseInt(br.readLine());  Hi Friend, Try the following code: import java.io.*; public class
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
Importing data into sql plus from a text file...
Importing data into sql plus from a text file...  How to import a text file into oracle 10g enterprise edition directly to create tables and data
Importing data into sql plus from a text file...
Importing data into sql plus from a text file...  How to import a text file into oracle 10g enterprise edition directly to create tables and data
Java String Datatype
Java String Datatype  Weather String in java is class or Datatype,if it's clss then How can i assign String str="hello";   String is a class found in the package java.lang.*. When we represent string in double quotes
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
jsp sql server 2005 connectivity
jsp sql server 2005 connectivity  your jsp mysql tutorial is very help full.Please tell me how to connect jsp with SQL server 2005
JSP SQL Error
JSP SQL Error  Hi While trying to execute the below code i'm getting the following error "java.sql.SQLException: Io exception: Got minus one from a read call ". please help me out. <% try{ String Username
sql query to get data from two tables
sql query to get data from two tables  how can i get the data from two different tables?   Hi Friend, Please visit the following link: JOIN Query Simple Query Thanks
Data fetch from multiple SQL tables - Hibernate
Data fetch from multiple SQL tables   I am in the process of writing my first hibernate application. I have a sql query that fetches data from... chapter 13 example that fetches data from one table. Please advice. SQL from
 

 

 

DMCA.com