Execute Query on Google Groups

336 views
Skip to first unread message

Takis Diakoumis

unread,
Jan 15, 2012, 10:32:28 PM1/15/12
to Execute Query
Hello

To simplify and consolidate discussion, Execute Query is now on Google
Groups.
Thanks to those who suggested it :)

Post your questions, queries and requests here....

You can still visit http://executequery.org/feedback.jsp or send me an
email directly using tak...@executequery.org. You can also use the
feedback feature within the application itself under the help menu.

Please visit http://executequery.org for the latest updates.

thanks
Takis

Frédéric Besnard

unread,
Jan 17, 2012, 8:32:47 AM1/17/12
to execut...@googlegroups.com
hello,

I'm using executeQuery with an underlying DB2 database. When there is an error, only the error code is displayed (for example, "SQLSTATE=42972"), and not the readable error message itself.

Is there a way to correct this ?

thx,

Takis Diakoumis

unread,
Jan 17, 2012, 11:37:36 PM1/17/12
to Execute Query
hi

i just tried this against DB2 v9.7.5 and any error message returned is
less than readable.

i executed a simple query for a table that does not exist. i received
a similar error message format to yours as below:

SELECT * FROM non_existent_table

DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704,
SQLERRMC=DB2ADMIN.NON_EXISTENT_TABLE, DRIVER=3.63.75
[SQL State: 42704]
DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098,
SQLERRMC=2;-204;42704;DB2ADMIN.NON_EXISTENT_TABLE, DRIVER=3.63.75
[SQL State: 42704]

i debugged the above and inspected the returned exception from DB2 and
it had exactly what is shown above. the second error line is the
embedded next exception. EQ will render the error messages as provided
by the database. it appears that DB2 does not provide much more than
what is returned by EQ.

There is nothing more EQ can do here to render a more usable error
message. perhaps someone else has some DB2 specific expertise (??).

sorry about that :)

thanks
Takis


On Jan 18, 12:32 am, Frédéric Besnard <frederic.besn...@gmail.com>
wrote:

Frédéric Besnard

unread,
Jan 18, 2012, 5:19:44 AM1/18/12
to execut...@googlegroups.com
well, following this page, the explicit message is supposed to be got by setting the "retrieveMessagesFromServerOnGetMessage" propertie to true in the JDBC URL. So I tried this:

import java.sql.*
import com.ibm.db2.jcc.DB2Driver
url = "jdbc:db2://<server>:<port>/<basename>:user=<user>;password=<pwd>;retrieveMessagesFromServerOnGetMessage=true;"
Connection con = DriverManager.getConnection(url)
con.createStatement().executeQuery("select count(*) from dummy")


Las, I still got the error code, and not the human readable message by itself ...

Anyway, this problem is independant of EQ, so, forget it.

Thanx Takis for having looked at it.

Frédéric Besnard

unread,
Jan 18, 2012, 5:53:28 AM1/18/12
to execut...@googlegroups.com
I in fact was wrong: adding ":retrieveMessagesFromServerOnGetMessage=true;" to the URL in EQ solves the problem !

For an unknown reason, this did not work in the small IDE I used (a groovy console), but it when right when launching from shell ...

Takis Diakoumis

unread,
Jan 18, 2012, 6:05:39 PM1/18/12
to Execute Query
thats great to know for DB2 - thanks for that.... though frankly i
think the messages from DB2 are still less than helpful.

another way to specify additional properties for the JDBC driver is
using the advanced tab from the connection panel. this uses key/value
pairs so you could have also specified that property here.

thanks again for sorting this out :)

Takis

On Jan 18, 9:53 pm, Frédéric Besnard <frederic.besn...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages