Code to insert date in to database

Code to insert date in to database

View Answers

June 1, 2009 at 1:14 PM

Hi Friend,

Try the following code:

<%@page import=" java.sql.*, java.util.*"%>
<%
try{
Connection conn=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
conn = DriverManager.getConnection("jdbc:odbc:access");

String INSERT_RECORD = "insert into insertDate(id,myDate) values(?, ?)";

PreparedStatement pstmt = conn.prepareStatement(INSERT_RECORD);
pstmt.setString(1, "1");
java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime());
pstmt.setDate(2, sqlDate);
pstmt.executeUpdate();
pstmt.close();
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>

Thanks

June 28, 2012 at 3:39 PM

this is for the help of jsp connection string and the jsbc connecting pool









Related Tutorials/Questions & Answers:
Code to insert date in to database - Development process
Code to insert date in to database  Hi , in my following code i want to store date in to msaccess database. i have tried many queries, but am getting error . plz send me code Error 500--Internal Server Error
insert date into database using jsf
insert date into database using jsf  Hello I need a simple example of source code to insert a date into a database using jsf what do I have to put in backing bean and page jsf ( i need juste a date ) thanks
Advertisements
Insert current date into MYSQL database
Insert current date into MYSQL database In this tutorial, you will learn how to insert current date into database. In most of the applications, there is a need to insert date or time to database. Mysql provides several datatypes
code for insert the value from jsp to access database
code for insert the value from jsp to access database  code for insert the value from jsp to access 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
php code: how to insert manual date and also retrieve records by selecting date field. - Date Calendar
php code: how to insert manual date and also retrieve records by selecting date field.  In PHP, how to insert user input date on mysql db. and also... to get the records by selecting date field in mysql. Please give me a correct code
date example with database
date example with database  i want to insert date in database(oracle) through jsp. thanx in advance
insert images into a Mysql database
insert images into a Mysql database  How can I insert images into a Mysql database
insert code jsp to access
insert code jsp to access   insert code jsp to access
insert and delete data in database
insert and delete data in database  insert and delete data in database from servlets through JDBC   Hi Friend, Please visit the following links:ADS_TO_REPLACE_1 Insert Data Delete Data ThanksADS_TO_REPLACE_2
Oracle Database - Insert System Time
Oracle Database - Insert System Time  Hi I want to insert only system time dynamically using a statement but not a prepared statement into Oracle Database please suggest me any code
help with JDateChooser to insert date into sql
help with JDateChooser to insert date into sql  TextField3 = new...?¦ Statement stmt=con.createStatement(); stmt.executeUpdate("insert into special...(this,"Data is successfully inserted into database."); }catch(Exception e
database is connected but not insert the data
database is connected but not insert the data  hi, i am getting connected to database.Retrive the data also but cannot insert the data into database. i am using msaccess2007.my inserstudententry.jsp code is follows,pls help me
Insert image in database
Insert image in database  Want a jsp-struts program in which the imageFile is in the form of getter and setter and inserted in the database as a Blob using . and then download the image and show on next jsp pg. No use
code for insert button
code for insert button    i want code for insert button(in image...;The given code uses Swing components to create a image button and allow the user... stored into the database. import java.sql.*; import java.awt.*; import
insert data into database
insert data into database  hi,thanks for reply just i am doing student information project,frontend is jsp-servlet and backend is msaccess2007. i... and studentmaster is the database table name. i am using same details. Now give
unable to insert data into database
unable to insert data into database    hello.i have a problem... the eid based on ename and the other is inserting data into database based...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert
unable to insert data into database
unable to insert data into database    hello.i have a problem... the eid based on ename and the other is inserting data into database based...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert
unable to insert data into database
unable to insert data into database    hello.i have a problem... the eid based on ename and the other is inserting data into database based...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert
unable to insert data into database
unable to insert data into database    hello.i have a problem... the eid based on ename and the other is inserting data into database based...=ps1.executeQuery(); ps2 = con.prepareStatement( "insert
insert code using spring - Spring
insert code using spring  Hi, Can any one send code for inserting the data in database using spring and hibernate .. Many thanks, Raghavendra  Hi Friend, Please visit the following link: http
insert data into database
insert data into database  type Exception report message description The server encountered an internal error () that prevented it from fulfilling... your jsp/servlet code
Insert Date using Statement - Development process
Insert Date using Statement   Hi, plz send me code for Storing system date using statement instead of preparedstatement. Thanks Prakash  Hi Friend, Try the following code: Thanks
To insert attachment file in database in JSP.
To insert attachment file in database in JSP.  I am doing project in JSP. How to insert attachment file in mysql database? Please suggest some solution. Your inputs is valuable to me.   Hi Friend, Visit HereADS
To insert maximum number of data in database.
To insert maximum number of data in database.  how to change string data type into clob data type in jsp   Hi Friend, Please visit the following link:ADS_TO_REPLACE_1 http://www.roseindia.net/jdbc/insert-clob
Insert a row in 'Mysql' table using JSP Code
Insert a row in 'Mysql' table using JSP Code In this section, we will discuss about how to insert data in Mysql database using JSP code. Query... between your Tomcat server & Mysql database Table. Code to insert row in Mysql
Displaying date in the preciding code
[] status = new String[3]; try { //Code to connect to the database String sql...Displaying date in the preciding code  while deploying the Bill date...) { e.printStackTrace(); } //Code to display the details
Insert Image into Mysql Database through Simple Java Code
Insert Image into Mysql Database through Simple Java Code... simple java code that how save image into mysql database. Before running this java code you need to create data base and table to save image in same database
To Upload and insert the file into Database with Current Date and Time In JSP
To Upload and insert the file  into Database with Current Date... to upload and insert the file in database with current date and time.   <...; This file upload and insert into database with current date and time using JDBC
insert user session into other oracle database table
table. with user id i also want to insert date and current time in to database...insert user session into other oracle database table   hello i am a doing my project in jsp-servlet. i have doubt that when a user login to his
To insert attachment file in database in JSP.
To insert attachment file in database in JSP.  I am doing project in JSP. How to insert attachment file in mysql database? Please suggest some... code:ADS_TO_REPLACE_1 1)page.jsp: <HTML> <HEAD><TITLE>Display
Retrieve Date Time Frm Database - Development process
(); For Retrieving date -------------- need code to retrieve date and time...Retrieve Date Time Frm Database  Hi Friend, Ow to retrieve Date and Time at a time from ms Access database. For Storing data time
Insert file data into database
Insert file data into database In this section, you will learn how to insert the file data into database. Description of code: Here we have used FileReader.... Now to insert this data into the database, we have established a database
insert data in the database using checkbox
insert data in the database using checkbox  i am fetching data from the database using servlet on the jsp page and there is checkbox corresponding... should i insert only checked data into database on submission.   We
insert values from excel file into database
the following link: Insert values from excel file to database...insert values from excel file into database   hi i want to insert... file that should go to database which exists. am using SQL Server management
help in insert code - JSP-Servlet
help in insert code  I have some doubt in following code. I want to insert value using prepared statement.we r accessing connection from other...;insert regiform values('"+firstname+"','"+address+"','"
Insert data in mysql database through jsp using prepared statement
; This is detailed jsp code that how to insert data into database by using prepared statement instead of statement.  Create a database: First create a database named... Insert data in mysql database through jsp using prepared statement
Import Excel file(date) into mysql database in php
Import Excel file(date) into mysql database in php  I try to import excel file which contains data date(yyyy-mm-dd) into mysql database in php. But it not insert the data in mysql. Code $fp = fopen("data.csv",'w'); fwrite
date
date   how to insert date in database? i need coding
insert and retrive image from sql server database in jsp
insert and retrive image from sql server database in jsp  what is the code to insert and retrive an image from sql server database in jsp
display date to jsp from database
display date to jsp from database   display date to jsp from database to calender if the start date and end date is available than calender date... not available in database field than show in green color and clickable. NOTE :- Date
Question about "Insert text file data into Database"
Question about "Insert text file data into Database"  Hey I was reading the tutorial "Insert text file data into Database", (awesome btw), and noticed that both a FileInputStream, a DataInputStream and a BufferedReader
insert rows from browsed file to sql database
, content of the file has to go to database. how can i insert record into database...insert rows from browsed file to sql database  i need to insert rows from excel to database by browsing the file in jsp. by connecting both
Insert database values in the file
Insert database values in the file In this section, you will learn how to retrieve the data from the database and insert into the file. Description of code... the database and stored it into arraylist. Then we have called the method writeToFile
file upload and insert name into database - JSP-Servlet
file upload and insert name into database  Hi, I just joined as a fresher and was given task to upload a file and insert its name into database... as a parameter, do string operations and insert into database
how to insert data in database using html+jsp
how to insert data in database using html+jsp  anyone know what is wrong with my code? print("<% /* Create string... and database name. Here machine name id localhost and database name
what is the jsp coding to insert a data in database tables
what is the jsp coding to insert a data in database tables  Dear Sir, I Want to know the coding for insert the data from jsp to oracle database.. my... that insert the form values to MySQL database. 1)register.jsp: <html> <form
download code from database
download code from database  how to download files from database
Java to insert picture to database - JSP-Servlet
Java to insert picture to database  Hi Guys, Please assist me on this. Below is the code I wanted to use to insert picture into Ms Sql server 2000 but after the insertion, I got this in the database (back-end
how to insert data into database using jsp & retrive
how to insert data into database using jsp & retrive  Hello, I have created 1 html page which contain username, password & submit button. in my oracle10G database already contain table name admin which has name, password

Ads