473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Proper error messages in com.ibm.db2.jcc.b.SqlException

Hi All
Just wondering if its possible get more descriptive error messages in
to com.ibm.db2.jcc.b.SqlException. getMessge or toString() methods
gives only SQL-error codes like:
SQLCODE: -1218, SQLSTATE: 57011, SQLERRMC: 4096

I am using universal driver...

Thanks for any help

Best Regads, Juha

Jan 20 '07 #1
5 19605
JuhaM wrote:
Hi All
Just wondering if its possible get more descriptive error messages in
to com.ibm.db2.jcc.b.SqlException. getMessge or toString() methods
gives only SQL-error codes like:
SQLCODE: -1218, SQLSTATE: 57011, SQLERRMC: 4096

I am using universal driver...

Thanks for any help

Best Regads, Juha
Try:

db2 ? sql1218

from DB2 command line (assuming you installed at least DB2 client).
If you are using DB2 Jcc Universal driver in T2 connectivity mode - you have
installed client software.
If you are using DB2 Jcc Universal driver in T4 connectivity mode (pure lava) -
you may not have installed client software. In this case you can install DB2
documentation locally - or use online version available at:

http://publib.boulder.ibm.com/infoce...w/v9/index.jsp

and search (you can also browse Reference->Messages->SQL Messages) for SQL1218.
here is link to this message:

http://publib.boulder.ibm.com/infoce...oc/sql1218.htm
Jan M. Nelken
Jan 20 '07 #2
JuhaM wrote:
Hi All
Just wondering if its possible get more descriptive error messages in
to com.ibm.db2.jcc.b.SqlException. getMessge or toString() methods
gives only SQL-error codes like:
SQLCODE: -1218, SQLSTATE: 57011, SQLERRMC: 4096

I am using universal driver...

Thanks for any help

Best Regads, Juha
Try:

db2 ? sql1218

from DB2 command line (assuming you installed at least DB2 client).
If you are using DB2 Jcc Universal driver in T2 connectivity mode - you have
installed client software.
If you are using DB2 Jcc Universal driver in T4 connectivity mode (pure java) -
you may not have installed client software. In this case you can install DB2
documentation locally - or use online version available at:

http://publib.boulder.ibm.com/infoce...w/v9/index.jsp

and search (you can also browse Reference->Messages->SQL Messages) for SQL1218.
here is link to this message:

http://publib.boulder.ibm.com/infoce...oc/sql1218.htm
Jan M. Nelken
Jan 20 '07 #3
Jan Nelken wrote:
JuhaM wrote:
>Hi All
Just wondering if its possible get more descriptive error messages in
to com.ibm.db2.jcc.b.SqlException. getMessge or toString() methods
gives only SQL-error codes like:
SQLCODE: -1218, SQLSTATE: 57011, SQLERRMC: 4096

I am using universal driver...
Thanks for any help
DB2 9 for LUW has a stored procedure to retrieve the messagetext for any
SQLCODE in the server language.
Check under "Administrative routines"

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html
Jan 20 '07 #4
Thanks everyone for the help. Actually I was hoping to get error
messages directly from java, without extra lookup. Perhaps I can use
this sp somehow..
Regards, Juha
Serge Rielau wrote:
Jan Nelken wrote:
JuhaM wrote:
Hi All
Just wondering if its possible get more descriptive error messages in
to com.ibm.db2.jcc.b.SqlException. getMessge or toString() methods
gives only SQL-error codes like:
SQLCODE: -1218, SQLSTATE: 57011, SQLERRMC: 4096

I am using universal driver...
Thanks for any help
DB2 9 for LUW has a stored procedure to retrieve the messagetext for any
SQLCODE in the server language.
Check under "Administrative routines"

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

WAIUG Conference
http://www.iiug.org/waiug/present/Fo...Forum2006.html
Jan 20 '07 #5
JuhaM wrote:
Hi All
Just wondering if its possible get more descriptive error messages in
to com.ibm.db2.jcc.b.SqlException. getMessge or toString() methods
gives only SQL-error codes like:
SQLCODE: -1218, SQLSTATE: 57011, SQLERRMC: 4096
You can do this (following the description here:
http://publib.boulder.ibm.com/infoce...d/tjvjcerr.htm

try {
stmt.executeUpdate("CREATE TABLE t ( a INT )");
} catch (SQLException e) {
System.out.println("SQL Exception");
System.out.println("=============");
System.out.println(e.getMessage()); // (1)
System.out.println("");
if (e instanceof DB2Diagnosable) {
DB2Diagnosable db2e = (DB2Diagnosable)e;
DB2Sqlca sqlca = db2e.getSqlca();
System.out.println(sqlca.getMessage()); // (2)
}
}

You will see in step (1) the error message that contains the sqlcode,
sqlstate, and tokens - which you posted above. On step (2) you will
receive the short message for the error. Or do you need the long error
message, which includes Explanation and User Response, i.e. exactly what
this would return:

$ db2 "? sql0601"
Here is an example of the output I got:

$ javac A.java && java A
SQL Exception
=============
DB2 SQL error: SQLCODE: -601, SQLSTATE: 42710, SQLERRMC: STOLZE.T;TABLE

The name of the object to be created is identical to the existing
name "STOLZE.T" of type "TABLE".

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Jan 21 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Steve | last post by:
Hi; I went to the microsoft site to try to find a guide to the error messages that the jdbc drivers give ( for sqlserver 2000 ). I had no luck. Does anyone know if there is such a guide? ...
2
by: FX NICOLAS | last post by:
Can anyone help me. I'm trying to retrieve data from DB2/AIX v8.1 using JDBC connectivity (Universal Driver - Type 4 - v1.1.67) . I get a recurrent error (after connection, apparently) : BEGIN...
3
by: tshad | last post by:
If you get an exception or SqlException, how do you get the actual message? Not the detailed breakdown, but the actual message. For example, in the following message, I would like to find just...
6
by: mperkins | last post by:
Hello. I have a curious problem. Occasionally executing a simple select against an AS400 DB2 database through JDBC fails with the following error: (SQLState = 57014) - java.sql.SQLException: ...
6
by: redashley40 | last post by:
This is my first attempt in SQL and PreparedStatement I have add the PreparedStatement and I'm not to sure if I'm doing it correctly. When I do a test run on Choose 1 ,or 2 I get this error. Error...
0
by: =?Utf-8?B?c3RldmVuLnRob21wc29u?= | last post by:
I have a c# web app in which I've recently been seeing some SQLException errors where the message portion of the error is being rendered in Japanese or some other unreadable language (to me at...
8
by: ajos | last post by:
hi frnds, the situation is im developing a web application in struts-- my specifications-eclipse3.2.2,struts1.1,tomcat5.5.23 mysql5.0 db. the scenario-i have a jsp page which adds the...
4
by: jdokos | last post by:
Hello All, I have a procedure that is getting -443 after upgrading to V9.5 FP1. The procedure was written to output only the SQLCODE. Here is the output that is returned: Value of output...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.