What  i feel is that is the problem with Data class.
I don't think it is driver problem. You can get
exact date format what ever you wnat with
Calendar class.

----- Original Message -----
From: "Hans Liebenberg" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 19, 2001 6:40 PM
Subject: Re: PreparedStatment and Dates


> How would that help me?
> I still need to insert a date using a prepared statement
>
> Personally I think it is the driver
>
>
> -----Original Message-----
> From: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of M H
> Rao
> Sent: 19 July 2001 13:57
> To: [EMAIL PROTECTED]
> Subject: Re: PreparedStatment and Dates
>
>
> Try with Calendar class..
>
> Rao
> ----- Original Message -----
> From: "Hans Liebenberg" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, July 19, 2001 6:11 PM
> Subject: PreparedStatment and Dates
>
>
> > Hi,
> >
> > I have run into a problem that doesn;t make much sense, I think I'm
> > obvioulsy being a bit stupid.
> > I am accessing a SQL server 7.0 database storing and retrieving datetime
> > field types.
> >
> > I want to insert the current date AND time into the field.
> >
> > Lets say my code was
> >
> >                 stmt = conn.prepareStatement("INSERT INTO
> myTable(?,?,?)");
> >                 stmt.setString(1, "blah");
> >                 stmt.setDate(2, new java.sql.Date(new
> > java.util.Date().getTime()));
> >                 stmt.setString(3, "blah");
> >                 stmt.executeUpdate();
> >
> > This only inserts the Date into the field i.e the resulting row looks
like
> > "blah" , "19/07/2001 00:00"
> >
> > so then I try...
> >
> >                 stmt = conn.prepareStatement("INSERT INTO
> myTable(?,?,?)");
> >                 stmt.setString(1, "blah");
> >                 stmt.setTime(2, new java.sql.Time(new
> > java.util.Date().getTime()));
> >                 stmt.setString(3, "blah");
> >                 stmt.executeUpdate();
> >
> > This only inserts the Time into the field i.e the resulting row looks
like
> > "blah" , "01/01/1900 13:59"
> >
> > What method can I use witha prepared statement?
> > Or is it perhaps my JDBC river that is buggared? Where can I can a good
> SQL
> > Server jdbc driver from?
> >
> > Thanks
> > Hans
> >
> >
>
___________________________________________________________________________
> > 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
>
>
___________________________________________________________________________
> 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