ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

This is a discussion on ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: within the JDBC JAVA forums in Framework and Interface Programming category; Hello All! When I use ResultSet getDate("TIME_STAMP") on a table with a TIME_STAMP column, which is defined as DATE, it returns "java.lang.NumberFormatException: For input string:" and here comes the month name in hebrew! How can I avoid this? Thanks!...

Go Back   Application Development Forum > Framework and Interface Programming > JDBC JAVA

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 01-28-2008, 11:18 AM
jaja
Guest
 
Default ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

Hello All!

When I use ResultSet getDate("TIME_STAMP") on a table with a
TIME_STAMP column, which is defined as DATE, it returns
"java.lang.NumberFormatException: For input string:" and here comes
the month name in hebrew!

How can I avoid this?

Thanks!
Reply With Quote
  #2  
Old 01-28-2008, 05:05 PM
joeNOSPAM@BEA.com
Guest
 
Default Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

On Jan 28, 8:18 am, jaja <dush...@012.net.il> wrote:
> Hello All!
>
> When I use ResultSet getDate("TIME_STAMP") on a table with a
> TIME_STAMP column, which is defined as DATE, it returns
> "java.lang.NumberFormatException: For input string:" and here comes
> the month name in hebrew!
>
> How can I avoid this?
>
> Thanks!


What DBMS, and what JDBC driver are you using?
Reply With Quote
  #3  
Old 01-29-2008, 01:54 AM
jaja
Guest
 
Default Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

Hi.
I am working with Oracle 9 , and using the oracle jdbc driver.

Just to be clearer, I need to format the date into my format, and of
course SimpleDateFormat don't recognize the monthe written in
hebrew...

Thanks.
Reply With Quote
  #4  
Old 01-29-2008, 01:58 AM
jaja
Guest
 
Default Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

Sorry, want to fix the last message...
The crash occures on

Date dtTimeStamp = rs.getDate("TIME_STAMP");

and not on the formatter.
Reply With Quote
  #5  
Old 01-29-2008, 10:12 AM
GArlington
Guest
 
Default Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

On Jan 28, 4:18 pm, jaja <dush...@012.net.il> wrote:
> Hello All!
>
> When I use ResultSet getDate("TIME_STAMP") on a table with a
> TIME_STAMP column, which is defined as DATE, it returns
> "java.lang.NumberFormatException: For input string:" and here comes
> the month name in hebrew!
>
> How can I avoid this?
>
> Thanks!


How in hell does the "TIME_STAMP column" return you a "month name in
hebrew"?
Are you storing the date/time stamp as a string in your DB?
Reply With Quote
  #6  
Old 01-29-2008, 10:51 AM
joeNOSPAM@BEA.com
Guest
 
Default Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

On Jan 28, 10:58 pm, jaja <dush...@012.net.il> wrote:
> Sorry, want to fix the last message...
> The crash occures on
>
> Date dtTimeStamp = rs.getDate("TIME_STAMP");
>
> and not on the formatter.


What do you see with:

Object obj = rs.getObject("TIME_STAMP");
System.out.println("It is a " + obj.getClass().getName() + " = " +
obj );
Reply With Quote
  #7  
Old 02-05-2008, 01:38 PM
Lothar Kimmeringer
Guest
 
Default Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: For input string:

jaja wrote:

> I am working with Oracle 9 , and using the oracle jdbc driver.


There are different JDBC-drivers for Oracle. Make sure that the
driver you're using works with the corresponding database. This
is especially important when using the OCI-driver (but problems
there usually end up with a crash of the process).

> Just to be clearer, I need to format the date into my format, and of
> course SimpleDateFormat don't recognize the monthe written in
> hebrew...


It would if you specify the correct Locale. But before you try
something like that, check if the column is really of type
timestamp/date. You can check the type with
resultset.getMetaData().getColumnType(colIndex).
It should return 91 (java.sql.Types.DATE) or 93
(java.sql.Types.TIMESTAMP). If it's 1, 12, or something
else, likelyhood is big that the value is already stored
in a wrong way inside the database.

Best would be try that out and report back.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: spamfang@kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
Reply With Quote
  #8  
Old 02-07-2008, 11:43 AM
Dumenicu Giuliani
Guest
 
Default Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:

jaja a écrit :
> Hello All!
>
> When I use ResultSet getDate("TIME_STAMP") on a table with a
> TIME_STAMP column, which is defined as DATE, it returns
> "java.lang.NumberFormatException: For input string:" and here comes
> the month name in hebrew!
>
> How can I avoid this?
>
> Thanks!

Use new Date(getTimestamp("TIME_STAMP").getTime())
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:37 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.