NO!!!!!.  cbirthday.getTime() returns a java.util.Date.  Remember that
cbirthday is a Calendar object.


-----Original Message-----
From: Adrian Janssen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 11:55 AM
To: [EMAIL PROTECTED]
Subject: Re: sql Date


cbirthday.getTime() returns a long - which cannot be cast to any type of
Date. Change your code to:

        birthday = new java.sql.Date ( cbirthday.getTime() );


> -----Original Message-----
> From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> Sent: 07 May 2002 10:50
> To:   [EMAIL PROTECTED]
> Subject:      Re: sql Date
>
> how do I acheive explicit casting because that is what the compiler
> complained about?
> I thought the following line should be ok but it rejects it.
>
> birthday = (java.sql.Date) cbirthday.getTime();
>
>
>
> -----Original Message-----
> From: Kesav, Ramesh [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 07, 2002 11:17 AM
> To: [EMAIL PROTECTED]
> Subject: Re: sql Date
>
>
> just make that as explicit casting like what have you done is correct.
>
> use preparedstatement and then use setObject method.
>
> Regards
>
> Ramesh Kesavanarayanan
> [EMAIL PROTECTED]
> Off : 8113801 ext 2333
> Res : 2265360
> Mob : 98412 73573
>
>
> > -----Original Message-----
> > From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 07, 2002 1:46 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: sql Date
> >
> > Even if I do that, how do I then convert the java.util.Date to
> > java.sql.Date?
> >
> >
> > -----Original Message-----
> > From: Bhushan_Bhangale [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 07, 2002 11:05 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: sql Date
> >
> >
> > First of all:-
> >
> > java.util.sql birthday = null;   should be   java.util.Date birthday =
> > null;
> >
> > as the Calendar.getTime() method returns a util date object.
> >
> > -----Original Message-----
> > From: Emmanuel Eze [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 07, 2002 1:34 PM
> > To: [EMAIL PROTECTED]
> > Subject: sql Date
> >
> >
> > Hi all,
> >
> > Can somebody pls tell me how I can insert a Date type into a database
> > table
> > with a Date datatype?
> >
> > I have the year, month, and day as integer values.  I need to convert
> > these
> > values into an sql Date object so I can now insert the Date object into
> > the
> > table, right?
> >
> > I have the following code:
> > Calendar cbirthday = null;
> > java.util.sql birthday = null;
> > .
> > .
> > .
> > cbirthday = Calendar.getInstance();
> > cbirthday.set(Integer.parseInt(year), Integer.parseInt(month),
> > Integer.parseInt(day));
> > birthday = cbirthday.getTime();
> >
> > This last statement throws a cast exception!  Even when I change it to:
> > birthday = (java.sql.Date) cbirthday.getTime();
> >
> > Pls tell me what I'm doing wrongly.
> >
> > Emma
> >
> >
> ==========================================================================
> > =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
> >
> >
> ==========================================================================
> > To
> > unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
> >
> >
> ==========================================================================
> > =
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

--
**********************************************************************
The Truworths e-mail facility may not be used for the distribution of
chain letters or offensive email.  Truworths hereby distances itself
from and accepts no liability for the unauthorised use of its e-mail
facility or the sending of e-mail communications for other than
strictly business purposes.  Truworths furthermore disclaims liability
for any unauthorised instruction for which permission was not granted.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to