Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / February 2008

Tip: Looking for answers? Try searching our database.

ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:     For input string:

Thread view: 
jaja - 28 Jan 2008 16:18 GMT
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!
joeNOSPAM@BEA.com - 28 Jan 2008 22:05 GMT
> Hello All!
>
[quoted text clipped - 6 lines]
>
> Thanks!

What DBMS, and what JDBC driver are you using?
jaja - 29 Jan 2008 06:54 GMT
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.
jaja - 29 Jan 2008 06:58 GMT
Sorry, want to fix the last message...
The crash occures on

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

and not on the formatter.
joeNOSPAM@BEA.com - 29 Jan 2008 15:51 GMT
> 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 );
Lothar Kimmeringer - 05 Feb 2008 18:38 GMT
>  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
Signature

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!

GArlington - 29 Jan 2008 15:12 GMT
> Hello All!
>
[quoted text clipped - 6 lines]
>
> 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?
Dumenicu Giuliani - 07 Feb 2008 16:43 GMT
jaja a écrit :
> Hello All!
>
[quoted text clipped - 6 lines]
>
> Thanks!
Use new Date(getTimestamp("TIME_STAMP").getTime())


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.