-->
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.  [ 1 post ] 
Author Message
 Post subject: Error Position on Native Query
PostPosted: Wed Oct 03, 2012 1:12 pm 
Newbie

Joined: Wed Oct 03, 2012 10:02 am
Posts: 1
Hello,

I'm doing one validator to SQL code.

The user will write some code and will return the result or the error.
When one error is found i need to show the code, message and the position/line where the error is. But i don't know how get the position.

Where is what i'm doing now:

try {
validator.checkSQL(sql2);
} catch (EJBTransactionRolledbackException e) {
e.printStackTrace();
Throwable t = e.getCause();

while (t != null) {
if(t instanceof SQLGrammarException) {

SQLGrammarException sqlexception = (SQLGrammarException) t;
System.err.println(sqlexception.getErrorCode());
System.err.println(sqlexception.getSQLState());
System.err.println(sqlexception.getMessage());
break;
}
...

SQLGrammarException don't have any method to get the Position. Someone knows if is possible get it?
Thanks!


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

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.