-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SQL -401 SQLSTATE 42818 with DB2 9.7.2
PostPosted: Fri Aug 06, 2010 11:24 am 
Newbie

Joined: Fri Aug 06, 2010 11:14 am
Posts: 1
I am using hibernate 3.3 to access DB2 tables. When we upgraded to DB2 9.7.2 on Linux last week, we found we had to modify some of our hibernate SQL queries in order to be compatible with DB2 9.7.2. With DB2 9.7.1 our hibernate SQL worked fine, but with DB2 9.7.2 we receive the SQL -401 SQLSTATE 42818 error with certain queries.

Below is the hibernate SQL before we modified it for DB2 9.7.2:

Query query = session.createQuery("from ACSystem s where s.systemnm=:searchstring");
query = query.setString("searchstring", name);
List list = query.list();
Iterator results =list.iterator();

After changing the code as follows, then it worked with DB2 9.7.2:

String querystring = "from ACSystem s where s.systemnm='"
+ name
+ "'";

Iterator results = session.createQuery(querystring).list().iterator();

Has anyone run into this?


Top
 Profile  
 
 Post subject: Re: SQL -401 SQLSTATE 42818 with DB2 9.7.2
PostPosted: Mon Oct 04, 2010 10:44 pm 
Newbie

Joined: Mon Oct 04, 2010 9:55 pm
Posts: 1
The problem is caused by the MySQL compatibility mode. It was on by default in my installation:

db2user@db2host:~$ db2set DB2_COMPATIBILITY_VECTOR
MYS

Turning it off fixed the problem:

db2user@db2host:~$ db2set DB2_COMPATIBILITY_VECTOR=0
db2user@db2host:~$ db2set DB2_COMPATIBILITY_VECTOR
0

db2user@db2host:~$ db2 stop database manager force
DB20000I The STOP DATABASE MANAGER command completed successfully.
db2user@db2host:~$ db2 start database manager
DB20000I The START DATABASE MANAGER command completed successfully.

After that my program started working again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.