my dog learned polymorphism*
The moose likes JDBC and the fly likes problem in fetching data from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "problem in fetching data from database" Watch "problem in fetching data from database" New topic

problem in fetching data from database

suresh gonuguntla

Joined: Feb 22, 2006
Posts: 11
In database it is showing the value of the 3rd column is in decimal form (i.e. 123.45)

String getInfo = "{CALL PKG_TICKET.IF_TINFO" + "(?, ?, ?)}";
gcs_getInfo = (OracleCallableStatement)go_dbConn.prepareCall(getInfo);
System.out.println("The amount in the Database:"+gcs_getInfo.getString(3));

But after executing this code, I got 123,45 in my log file, while it's value is 123.45 in DB.

Is there any problem in code or any conversion problem in database or what???

Plz provide the solution as quick as possible
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3702

Try using getLong() or getDouble() instead of getString(). Then you can use a java number formatter to display the number properly.

My Blog: Down Home Country Coding with Scott Selikoff
subject: problem in fetching data from database
Similar Threads
Try Ruby! 15 minutes
Program like ATM where person enters amount in dollars and cents but program uses int for monies
Best Practice and proper syntax
idl2java compilation error