Hi Werner,

 

            Thank you for taking the time…

 

            I have a CastorOQLQuery class acting as a parser to prepare the final SQL command string for OQLQuery creation. My CastorOQLQuery is passed the relevant Database and has SQL command portions appended to it until all portions are complete. When the string is complete, I call the getOQLQuery method that binds a passed value to the newly created OQLQuery. A typical example is this:

 

class CastorOQLQuery {

 

            // An example “built” SQL command string.

            // This changes from instance to instance.

            String mySQLString = “SELECT s FROM my_table s WHERE s.name like $1”;

 

            public OQLQuery getOQLQuery(Database databaseIn, String valueIn) {

                        OQLQuery returnQuery = databaseIn.getOQLQuery(mySQLString);

                        returnQuery.bind(valueIn);

 

                        return returnQuery;

            }

}

 

            I will create the OQLQuery with a call to the method above:

 

            OQLQuery oql = myCastorOQLQuery.getOQLQuery(myDatabase, “myDesiredValue”);

 

When I subsequently call oql.execute( ) I will often get the following exception when the underlying table I am searching contains Integer fields:

 

Caught exception org.exolab.castor.jdo.PersistenceException: Nested error: java.sql.SQLException: Unknown type '246 in column 1 of 89 in binary-encoded result set. while executing ….

 

When I look at column 1 in the table, it is an integer type with a primary key (although it will also happen on integer fields that are not keys).

 

Important note: All of this code works using the exact same 0.9.6 Castor/doclets/jdom package with MySQL Connector/J 3.1.7 and MySQL 4.X. As soon as I upgrade the MySQL service to use 5.0, the error occurs.

 

Additional important note: As mentioned earlier, I have no problem accessing the integer columns via the mySQL command line client or through regular statement calls made directly to the connection.

 

What am I missing here?

 

Thanks again!

 

Michael Stabler

Software Engineer

[EMAIL PROTECTED]

202.863.3580

www.cssiinc.com


From: Werner Guttmann [mailto:[EMAIL PROTECTED]
Sent: Monday, April 11, 2005 3:54 PM
To: [email protected]
Subject: Re: [castor-user] Problems with OQLQuery result set using MySQL 5.X?

 

Michael,

whilst I don't have any first-hand experience with mySQL 5.0 yet, can you please provide us with some sample code that shows what you are trying to achieve ?

Regards
Werner

--Original Message Text---
From: Michael Stabler
Date: Mon, 11 Apr 2005 15:23:06 -0400



Has anyone had a problem with invalid Types being sent to result sets from OQLQueries? I am using MySQLs Connector/J 3.1.7.



When executing something like myResultSet = myOQLQuery.execute( ), I get an SQL exception nested in a PersistenceException. Generally, the SQL exception is being caused by an Invalid Type 246 returned for some integer-type fields.



This only happens when I execute the SQL statement via the OQLQuery. If I run the same command directly through the Connector, everything works fine. If I use MySQLs command line, everything works fine. I havent tried it yet using the OQLQuery pass-through feature. Going to try that next just for confirmation.



Thanks in advance,



Michael Stabler

Software Engineer

[EMAIL PROTECTED]

202.863.3580

www.cssiinc.com



Reply via email to