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 / May 2005

Tip: Looking for answers? Try searching our database.

pb with getString on a preparedStatement with sum

Thread view: 
flm - 23 May 2005 00:33 GMT
I'm using java 1.4, mysql 4.1.7 and jconnector 3.1.8
When I execute a preparedStatement with a sum on an integer field,
getString gives me decimals.
This pb didn't occur with jdbc 3.0.11 witch I was using before or with
a normal statement.

Any explanation ?
Thanks,
FLM
tzvika.barenholz@gmail.com - 23 May 2005 10:58 GMT
Why not use getInteger or getLong ? when you use getString you are
counting on the driver to cast for you which will not make for very
portable code.
Mark Matthews - 23 May 2005 17:52 GMT
> I'm using java 1.4, mysql 4.1.7 and jconnector 3.1.8
> When I execute a preparedStatement with a sum on an integer field,
[quoted text clipped - 5 lines]
> Thanks,
> FLM

FLM,

We'd have to see all of the code (schema/query) involved. My guess is
that for whatever reason, server prepared statements think you're using
something floating-point, and are thus returning floating point values.
Without any more information, we'd only be guessing, which isn't very
productive.

    -Mark

Signature

Mark Matthews
MySQL AB, Software Development Manager - Connectivity
www.mysql.com



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.