-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate - DB2/400 ???
PostPosted: Mon Sep 01, 2003 11:11 am 
Beginner
Beginner

Joined: Mon Sep 01, 2003 10:52 am
Posts: 23
Location: UK
Hi

As you may guess I am new to Hibernate.

I have downloaded struts-hibernate example by Ted Husted and have got it working fine with IBM DB2UDB7 on Windows XP.

The problem is that I have tried the same app trying to access a DB2/400 on iseries.

I get the following error

SELECT user.user_uid as user_uid, user.version as version, user.name as name, user.userName as userName FROM cl_users user WHERE (user.userName=? )
[01/09/03 15:47:05:762 BST] 5a3e1560 JDBCException W net.sf.hibernate.util.JDBCExceptionReporter SQL Error: -104, SQLState: 42601
[01/09/03 15:47:05:792 BST] 5a3e1560 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter [SQL0104] Token . was not valid. Valid tokens: + - AS <IDENTIFIER>.
[01/09/03 15:47:05:812 BST] 5a3e1560 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter Could not execute query
[01/09/03 15:47:05:842 BST] 5a3e1560 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter TRAS0014I: The following exception was logged java.sql.SQLException: [SQL0104] Token . was not valid. Valid tokens: + - AS <IDENTIFIER>.
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:520)


My hibernate.properties file looks like

hibernate.connection.driver_class = com.ibm.as400.access.AS400JDBCDriver
hibernate.connection.url = jdbc:as400://TFMAIN/NETDATA
hibernate.connection.username = NETDATA
hibernate.connection.password = HTTPSVR
hibernate.dialect =net.sf.hibernate.dialect.DB2Dialect
hibernate.show_sql = true


any help with with this would be extremely appreciated.

kind regards
Paul


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2003 1:14 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Its been a while since I've worked with DB2/400, but I'm going to take a wild guess that "user" is a reserved word.

Is this a result of attempting to execute an HQL query? If so, try changing your alias from user to something more benign.

For example, if you have "from User as user where user.userName = :userName", change it to "from User as u where u.userName = :userName"...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 01, 2003 6:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
right.


or just upgrade to a newer version of hibernate, which doesn't pass aliases directly through.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 03, 2003 3:14 am 
Beginner
Beginner

Joined: Mon Sep 01, 2003 10:52 am
Posts: 23
Location: UK
Guys

Thanks for the replies.

I upgraded to hibernate 2.0.3 but I got the same errors.

I then changed the alias from 'user' to 'u' and it worked.

I will continue to use 2.0.3 with the rest of the development.

Once again thanks guys

Paul


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.