In DB2Plugin.sessionStarted there
is this code:
// Install DB2JCCExceptionFormatter iff we're using the JCC driver
try
{
if
(JCC_DRIVER_NAME.equals(session.getMetaData().getJDBCMetaData().getDriverName()))
{
session.setExceptionFormatter(new DB2JCCExceptionFormatter());
}
..
public static final String JCC_DRIVER_NAME = "IBM DB2 JDBC Universal
Driver Architecture";
When I run the test code on DB2 9.7 IBM-provided driver (db2jcc.jar,
db2jcc_license_cu.jar), I get this name:
DatabaseMetaData md = con.getMetaData();
System.out.println("Driver name: " + md.getDriverName());
output:
Driver name: IBM Data Server Driver for JDBC and SQLJ
In my experience, this driver works perfectly with SquirrelSQL 3.4,
I've had no problem using it. I also am able to get extended error codes
like this, pretty much copy from Squirrel (your?) code:
Method getSqlca = t.getClass().getMethod("getSqlca", (Class[]) null);
Object sqlca = getSqlca.invoke(t, (Object[]) null);
// String msg = sqlca.getMessage();
Method getMessage = sqlca.getClass().getMethod("getMessage", (Class[])
null);
String msg = getMessage.invoke(sqlca, (Object[]) null).toString();
output:
"DBO.TEST5" is an undefined name.. SQLCODE=-204, SQLSTATE=42704,
DRIVER=4.13.127
Exception in thread "main" java.lang.NullPointerException
at test.TestDB2.main(TestDB2.java:60)
However, those are not all the problems that prevent displaying extended error codes with newer DB2 versions (9.7, 10.1) and their drivers. I managed to get plugin corrected if not in completely clean way, I attach modified files.
Marcin Krol
2013-02-17
2nd file
Gerd Wagner
2013-03-12
Gerd Wagner
2013-03-12
Fixed in our GIT repository. Will be available in future snapshots and versions.