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



Home Answers Viewqa Development-process Code to insert date in to database
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rajendra
Code to insert date in to database
2 Answer(s)      5 years and 7 months ago
Posted in : Development process



Advertisement
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 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: Insert Data Delete Data Thanks
insert code jsp to access
insert code jsp to access   insert code jsp to access
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
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
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
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
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  type Exception report message description The server encountered an internal error () that prevented it from fulfilling... your jsp/servlet code
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 Here Thanks
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
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: http://www.roseindia.net/jdbc/insert-clob-example.shtml Thanks
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... file upload and insert into database with current date and time. Table Structure... into the database with current date and time. Download the Code  
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...; Mysql database Table. Code to insert row in Mysql table : databaseinsertion.jsp
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: 1)page.jsp: <HTML> <HEAD><TITLE>Display file upload form
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
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 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
Advertisements
 

 

 

DMCA.com