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 / General / February 2006

Tip: Looking for answers? Try searching our database.

jsCreator2 - CachedRowSetXImpl - returns 4294967297 instead of 1

Thread view: 
Lyall - 05 Feb 2006 10:41 GMT
CachedRowSetXImpl - returns 4294967297 instead of 1
Author: LyallInOz  Posts: 5   Registered: 2/3/06
        Feb 5, 2006 12:50 AM
I retrieve data from a query and the returned value is 4294967297
instead of 1 (which is what it is in the database).
This is 0x10000001 rather than the expected 0x0000001
I have dug around in the debugger and found the column values in the
result set, and yes, the object does contain the large number.

The APP code

       CachedRowSet userRowSet = new CachedRowSetXImpl();
       try {
           userRowSet.setDataSourceName("java:comp/env/jdbc/MyAppDB");
           userRowSet.setCommand(
                   "select Users.encryptedPassword,
Users.knownAs,        ApplicationRoles.shortName,
ApplicationRoles.idApplicationRole   from ApplicationRoles inner join
Users on          (ApplicationRoles.idApplicationRole =
Users.idApplicationRole) where Users.nameUser = ?"
                   );
           userRowSet.setString(1,loginUsernameString );
           userRowSet.execute();
           if (! userRowSet.next()) {
               return;
           }

The table in question is

mysql> describe ApplicationRoles;
+-------------------+------------------+------+-----+---------+----------------+
| Field             | Type             | Null | Key | Default | Extra
      |
+-------------------+------------------+------+-----+---------+----------------+
| idApplicationRole | int(10) unsigned | NO   | PRI | NULL    |
auto_increment |
| shortName         | varchar(32)      | YES  |     | NULL    |
      |
+-------------------+------------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)

Output from MySQL using the exact query from the app ->

mysql> select Users.encryptedPassword,        Users.knownAs,
ApplicationRoles.shortName,        ApplicationRoles.idApplicationRole
from ApplicationRoles inner join Users on
(ApplicationRoles.idApplicationRole = Users.idApplicationRole) where
Users.nameUser = 'lyallp';
+-------------------+---------+-----------+-------------------+
| encryptedPassword | knownAs | shortName | idApplicationRole |
+-------------------+---------+-----------+-------------------+
| password          | Lyall   | User      |                 1 |
+-------------------+---------+-----------+-------------------+
1 row in set (0.02 sec)

Under Linux, JSC 2
With MySQL 5.0.18
Using jdbc-mysql.jar with manifest info

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: Blackdown-1.4.2-03 (Blackdown Java-Linux Team)
Built-By: portage

Name: common
Specification-Title: JDBC
Specification-Version: 3.0
Specification-Vendor: Sun Microsystems Inc.
Implementation-Title: MySQL Connector/J
Implementation-Version: 3.1.10
Implementation-Vendor: MySQL AB

Curiously enough, this whole thing worked fine when I established my
own Context, DataSource, Connection and created my own
PreparedStatement and ResultSet.

Am I doing something silly?

...Lyall
Lyall Pearce - 06 Feb 2006 05:26 GMT
> CachedRowSetXImpl - returns 4294967297 instead of 1
> Author: LyallInOz  Posts: 5   Registered: 2/3/06
[quoted text clipped - 75 lines]
>
> ...Lyall

Found the problem, had MySQL column setup as 'INTEGER', changing it to
'INT' fixed the problem.

...Lyall
Lyall Pearce - 06 Feb 2006 13:07 GMT
>>CachedRowSetXImpl - returns 4294967297 instead of 1
>>Author: LyallInOz  Posts: 5   Registered: 2/3/06
[quoted text clipped - 80 lines]
>
> ...Lyall
Maybe it was more like that I had the columns as UNSIGNED, that seemed
to be the key.


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



©2009 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.