jsCreator2 - CachedRowSetXImpl - returns 4294967297 instead of 1

Discussion in 'Java' started by Lyall, Feb 5, 2006.

  1. Lyall

    Lyall Guest

    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, Feb 5, 2006
    #1
    1. Advertisements

  2. Lyall

    Lyall Pearce Guest

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

    ....Lyall
     
    Lyall Pearce, Feb 6, 2006
    #2
    1. Advertisements

  3. Lyall

    Lyall Pearce Guest

    Maybe it was more like that I had the columns as UNSIGNED, that seemed
    to be the key.
     
    Lyall Pearce, Feb 6, 2006
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.