Results 1 to 2 of 2

Thread: insert date

  1. #1
    swamy4311 is offline Member
    Join Date
    Sep 2010
    Rep Power

    Default insert date

    hi i wrote this below code to insert the date in the mysql but it not stored in can i solve thiss problem...plse help me

    DriverManager.registerDriver(new com.mysql.jdbc.Driver());
    Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/swamy","root","");
    PreparedStatement pstmt=con.prepareStatement("insert into dform values(?,?)");
    pstmt.setDate(2,new Date());

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power


    What happens?
    What exception do you get?

    How do you know it isn't stored in the database?

Similar Threads

  1. Replies: 2
    Last Post: 07-28-2010, 05:14 PM
  2. How to insert DATE into mysql using JSP?
    By sivakumar_sakam in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 12-27-2009, 08:52 PM
  3. Problem when insert Date to database(SQL)
    By hungleon88 in forum JDBC
    Replies: 6
    Last Post: 04-29-2009, 04:53 PM
  4. Replies: 3
    Last Post: 02-28-2009, 10:17 AM
  5. Replies: 1
    Last Post: 10-10-2008, 09:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts