Hello,

I'd try something like:

PreparedStatement ps = con.prepareStatement("INSERT INTO table  VALUES (? ,
?)");
ps.setInt(1,12);
ps.setDate(new java.sql.Date(System.currentTimeMillis()));

ps.executeUpdate();

Maybe that helps.

best regards

-Andreas

On Monday 03 December 2001 12:17, you wrote:
> Hi all,
>          I have a table with four data/time fields in the table. I want to
> insert a row and i am using the sql command as "insert into table_name
> values ({d \'yyyy-mm-dd\'},{d \'yyyy-mm-dd\'},{d \'yyyy-mm-dd\'},{d
> \'yyyy-mm-dd\'})".I do not get a compile error nor a runntime error, but
> when i check the database row is not inserted.
>
> here is the code
>
>         Connection con;
>                                     // creates a reference for Connection
> Class Statement st=null;
>                                         // creates a reference for
> Statement Class ResultSet rs;
>                 try
>                         {
>
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>                                   // define the Driver con =
> DriverManager.getConnection("jdbc:odbc:"+dns,dnsName,dnsPassword); // Get
> the Connection st = con.createStatement();
>                          // Create Statement String sql = "Insert into
> Budget_Project_Definition values (12,{d \'2001-12-03\'})";
>
>                         int result = st.executeUpdate(sql);
>                         System.out.println("A    "+result);
>                         con.setAutoCommit(true);
>                         }catch(Exception e){
>                         e.printStackTrace();
>                                 }
>
> Thanks in advance
>
> Nandish
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to