473,883 Members | 1,523 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 19672
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
10407
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
9265
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
7239
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
2359
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
1187
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
12823
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
7750
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
9932
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9777
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10728
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...
1
10833
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10405
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
9558
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...
0
5782
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...
0
5980
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3227
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.