Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm..

 
   Database Forums (Home) -> Java RSS
Next:  resorting recordset returned from SQL stroed proc..  
Author Message
jaja

External


Since: Jan 28, 2008
Posts: 3



(Msg. 1) Posted: Mon Jan 28, 2008 8:18 am
Post subject: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException:
Archived from groups: comp>lang>java>databases (more info?)

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!

 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
joe.weinstein

External


Since: Feb 21, 2005
Posts: 87



(Msg. 2) Posted: Mon Jan 28, 2008 2:05 pm
Post subject: Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 28, 8:18 am, jaja 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?

 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
jaja

External


Since: Jan 28, 2008
Posts: 3



(Msg. 3) Posted: Mon Jan 28, 2008 10:54 pm
Post subject: Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.
 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
jaja

External


Since: Jan 28, 2008
Posts: 3



(Msg. 4) Posted: Mon Jan 28, 2008 10:58 pm
Post subject: Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

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

and not on the formatter.
 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
GArlington

External


Since: Jan 29, 2008
Posts: 1



(Msg. 5) Posted: Tue Jan 29, 2008 7:12 am
Post subject: Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 28, 4:18 pm, jaja 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?
 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
joe.weinstein

External


Since: Feb 21, 2005
Posts: 87



(Msg. 6) Posted: Tue Jan 29, 2008 7:51 am
Post subject: Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Jan 28, 10:58 pm, jaja 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 );
 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
Lothar Kimmeringer

External


Since: Nov 06, 2007
Posts: 3



(Msg. 7) Posted: Tue Feb 05, 2008 3:01 pm
Post subject: Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: For input string: [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.TakeThisOut@kimmeringer.de
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
Dumenicu Giuliani

External


Since: Feb 07, 2008
Posts: 1



(Msg. 8) Posted: Thu Feb 07, 2008 3:01 pm
Post subject: Re: ResultSet getDate(TIME_STAMP) returns java.lang.NumberFormatException: [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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())
 >> Stay informed about: ResultSet getDate(TIME_STAMP) returns java.lang.NumberForm.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
java.lang.NullPointerException while updating datetime field - Hi, I am banging my heads for last several days with this issue. I am trying to update a field which is a datetime field in a table in the ORACLE database. I am using JAVA1.5 and JDBC:ODBC driver for making the bridge. After i run the following prog i..

Oracle 10g returns DATE as java.sql.Date? - I noticed that Oracle 10g XE, with the ojdbc14.jar JDBC driver, returns DATE columns as java.sql.Date valuess. That surprised me, because the ResultSetMetaData claims the column's Java type is java.sql.Timestamp -- which would make more sense since DATE....

jsp Errorjava.lang.NullPointerException - Hello , I have 3 textboxes(username,password, dept) of the jsp page and 2 buttons(call,submit). Onclick of call btn Department.jsp opens and onclick of radiobutton the deptcode is displayed in dept textbox(third textbox). I have disabled dept textbox....

jsp textbox Errorjava.lang.NullPointerException - Hello , I have 3 textboxes(username,password, dept) of the jsp page and 2 buttons(call,submit). Onclick of call btn Department.jsp opens and onclick of radiobutton the deptcode is displayed in dept textbox(third textbox). I have disabled dept textbox....

error in resultset - public static UserDTO getUserDTO(String userName) { UserDTO userDTO=null; // a simple bean with username and password with get-set methods try { if(isConnected) //flag indicating database connectivity {..
   Database Forums (Home) -> Java All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]