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 / January 2006

Tip: Looking for answers? Try searching our database.

java long in an Access database

Thread view: 
aaronfude@gmail.com - 15 Jan 2006 23:40 GMT
Hi,

Perhaps this is more of an Access question. I'm discovering that
Access' "Long Integer" cannot store a java Long. So I'm resorting to
string the numbers as strings. I'm I doing the right thing (other than
using Access :)  ) or missing someting?

Many thanks in advance!

Aaron Fude
Arto Viitanen - 16 Jan 2006 11:41 GMT
> Hi,
>
[quoted text clipped - 6 lines]
>
> Aaron Fude

Why not use java.math.BigDecimal? ResultSet supports it (getBigDecimal
etc.) and you can (kind of) calculate with it. If scale is 0, it behaves
like integer.

--

Arto Viitanen, CSC
Espoo, Finland
Bjorn Abelli - 19 Jan 2006 14:21 GMT
"Arto Viitanen" wrote...

>> Perhaps this is more of an Access question. I'm discovering that
>> Access' "Long Integer" cannot store a java Long. So I'm resorting to
>> string the numbers as strings. I'm I doing the right thing (other than
>> using Access :)  ) or missing someting?

> Why not use java.math.BigDecimal? ResultSet supports it (getBigDecimal
> etc.) and you can (kind of) calculate with it. If scale is 0, it behaves
> like integer.

You've misunderstood the question of the OP.

He doesn't need an alternative to long on the Java side, where obviously a
long is sufficient.

To change from long to BigDecimal wouldn't solve his problem.

As Access/Jet doesn't even support a Java long in numerical form, to change
to BigDecimal would be even worse...

I believe the OP have to live with his current solution, as Access/Jet most
likely will keep the old VB compatible data types only.

Depending on what the OP actually uses the fields for, another solution
*could* be to bitmask the long value (64 bits) into two int's (32 bits) and
store them separately in two fields in the DB, and correspondingly merge
them together into one field when retrieving them from the DB...

I don't know if he would gain anything with it comparing to the "string"
version, but it's nevertheless an alternative...

...or to change to another DB...

// Bjorn A
aaronfude@gmail.com - 29 Jan 2006 19:29 GMT
> "Arto Viitanen" wrote...
>
[quoted text clipped - 31 lines]
>
> // Bjorn A

What a complete answer! Thank you very much!

Can I assume that more serious databases, such as MySQL support the
long format?

Thanks!
IchBin - 29 Jan 2006 20:43 GMT
>> "Arto Viitanen" wrote...
>>>> Perhaps this is more of an Access question. I'm discovering that
[quoted text clipped - 35 lines]
>
> Thanks!

Would guess most all do.. In this case you are just dealing with Microsoft.

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

Bjorn Abelli - 30 Jan 2006 10:10 GMT
> Bjorn Abelli wrote:

>> ...or to change to another DB...
>>
[quoted text clipped - 4 lines]
> Can I assume that more serious databases, such as MySQL support the
> long format?

MySQL has the data type BIGINT, which corresponds very well to a Java long
(64 bits integer).

// Bjorn A


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.