473,698 Members | 2,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 19660
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 "Administra tive 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 "Administra tive 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.executeUpd ate("CREATE TABLE t ( a INT )");
} catch (SQLException e) {
System.out.prin tln("SQL Exception");
System.out.prin tln("========== ===");
System.out.prin tln(e.getMessag e()); // (1)
System.out.prin tln("");
if (e instanceof DB2Diagnosable) {
DB2Diagnosable db2e = (DB2Diagnosable )e;
DB2Sqlca sqlca = db2e.getSqlca() ;
System.out.prin tln(sqlca.getMe ssage()); // (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
10400
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? I got this mysterious error message below in my logs ( nothing visible
2
9238
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 TRACE_DIAGNOSTICS java.sql.SQLException SQL state = null Error code = -99999 Message = Unicode string can't convert
3
511
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 "Incorrect syntax near the keyword 'and'." or "System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'and'." instead of:
6
7236
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: Cursor CRSR0002 opened. Does anyone know what might be causing this error?
6
2348
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 - com.mysql.jdbc.Statement here is my code below public class DBAssign { /**
0
1181
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 least). Most of the time I refresh the screen and the error goes away. It's very bizarre, yet concerning. Here's an example from the event log on my machine: Exception Type: System.Data.SqlClient.SqlException Errors:...
8
12760
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 records in the db.when the user clicks submit,a javascript gets fired and checks the validation.on submit the BdgMastAction.java does all the data access and forwards the control to a jsp named bdgm.jsp.the results are displayed in the jsp.the values...
4
7728
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 parameters -------------------------- Parameter Name : V_OUTPUT Parameter Value : ERR:-443
0
9170
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8873
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7740
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6528
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.