extended error msgs when using DB2

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

extended error msgs when using DB2

mk-32
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everyone,

I have specified "errors=full" in Driver properties tab in Alias
properties, but I still get only typical error code:


Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=OWNER,
DRIVER=4.13.127
SQLState:  42703
ErrorCode: -206


The same query when ran in db2 cmdline tool:

db2 => select * from sysibm.systables  where owner = 'SAM'  and type = 'T';
SQL0206N  "OWNER" is not valid in the context where it is used.
SQLSTATE=42703


Is there a way of getting a message accompanying error code in Squirrel?


Regards,
Marcin Krol
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJRHi1oAAoJEFMgHzhQQ7hO0S4H/jI5M0+mCqE8UGvaZsc6xnP2
DgEhDejEt6RmhtfbwniuYU1pDafFC+2149meTA3DuUc6gZoEk7rTXHXail4PTRnM
wYdHi8Vpoo/3l+gEGHM8WZJ2DajNSPw0zmBDp5AC4VMZbb0uvUi8NTprQ9foyJV3
OEPtFu1IGK1k9Yzm2fE3iMC9tDKTNge0xkrXUwmKCWJQxMDDY4fep3lzlzRAgcVX
EnkGq7LWpLd16p5L5uomtq0F/SsafXbmK/zs+2WpjW4G1RvmuQ+rT2Vs0v5gwafL
rARiMbxShBg9fWvFXCKgf7Rdan61csKm4TOmq3Wu5AuFFVncQcxomFmnRn1x2Ds=
=8B0M
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
Reply | Threaded
Open this post in threaded view
|

Re: extended error msgs when using DB2

Robert Manning
If you have the DB2 plugin loaded, it will attempt get "human-readable" messages using DB2-specific classes in the JDBC driver.  Check to see that you have the DB2 plugin loaded (Plugins -> Summary -> Internal Name == db2)

Rob

On Fri, Feb 15, 2013 at 7:43 AM, Marcin Krol <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everyone,

I have specified "errors=full" in Driver properties tab in Alias
properties, but I still get only typical error code:


Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=OWNER,
DRIVER=4.13.127
SQLState:  42703
ErrorCode: -206


The same query when ran in db2 cmdline tool:

db2 => select * from sysibm.systables  where owner = 'SAM'  and type = 'T';
SQL0206N  "OWNER" is not valid in the context where it is used.
SQLSTATE=42703


Is there a way of getting a message accompanying error code in Squirrel?


Regards,
Marcin Krol
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJRHi1oAAoJEFMgHzhQQ7hO0S4H/jI5M0+mCqE8UGvaZsc6xnP2
DgEhDejEt6RmhtfbwniuYU1pDafFC+2149meTA3DuUc6gZoEk7rTXHXail4PTRnM
wYdHi8Vpoo/3l+gEGHM8WZJ2DajNSPw0zmBDp5AC4VMZbb0uvUi8NTprQ9foyJV3
OEPtFu1IGK1k9Yzm2fE3iMC9tDKTNge0xkrXUwmKCWJQxMDDY4fep3lzlzRAgcVX
EnkGq7LWpLd16p5L5uomtq0F/SsafXbmK/zs+2WpjW4G1RvmuQ+rT2Vs0v5gwafL
rARiMbxShBg9fWvFXCKgf7Rdan61csKm4TOmq3Wu5AuFFVncQcxomFmnRn1x2Ds=
=8B0M
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users


------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
Reply | Threaded
Open this post in threaded view
|

Re: extended error msgs when using DB2

mk-32
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I do have it loaded, it is marked in column Load at startup as well.
Version 0.04.

Db2: 10.1 GA (no fixpacks), platform: win7 x64.

Thanks!


Robert Manning wrote:

> If you have the DB2 plugin loaded, it will attempt get "human-readable"
> messages using DB2-specific classes in the JDBC driver.  Check to see
> that you have the DB2 plugin loaded (Plugins -> Summary -> Internal Name
> == db2)
>
> Rob
>
> On Fri, Feb 15, 2013 at 7:43 AM, Marcin Krol <[hidden email]
> <mailto:[hidden email]>> wrote:
>
> Hello everyone,
>
> I have specified "errors=full" in Driver properties tab in Alias
> properties, but I still get only typical error code:
>
>
> Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=OWNER,
> DRIVER=4.13.127
> SQLState:  42703
> ErrorCode: -206
>
>
> The same query when ran in db2 cmdline tool:
>
> db2 => select * from sysibm.systables  where owner = 'SAM'  and type
> = 'T';
> SQL0206N  "OWNER" is not valid in the context where it is used.
> SQLSTATE=42703
>
>
> Is there a way of getting a message accompanying error code in Squirrel?
>
>
> Regards,
> Marcin Krol

-
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
<mailto:[hidden email]>
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJRH4JKAAoJEFMgHzhQQ7hO2x8H/Rnb8YWR4jw4IzQIcEY0lS1P
xT3c48dZFql0iuL4fKNPdYYhBJVBH9aBjFCt6aiSe1rXbJjRs+tAcH1FwdwjtuqG
R5Ylz4LdBVv0uFL6V1AWbUeNul9Y/AHIG6kAhfFjOYRhoBAK0G4eNxcYHE4CqeDJ
+G0OWiD7qJaMp1TaXDe6SrIL/czG5Brskx2w0f9IpHXgJRRp7ZdKobZws7nssh+J
vUDG46Oogiwc4Dcmi4BYvpn17L2JC9CFk23X/4BOz2fLptxo2LJXstBHqv585hRG
NOCMHKjQ10PDPs1rgmSmF5w7JqJ9ZnZXd1W67cJ6/th9o0ewWskw+eSA/pi9s1o=
=1uHH
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
Reply | Threaded
Open this post in threaded view
|

Re: extended error msgs when using DB2

mk-32
In reply to this post by Robert Manning
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Robert,

I think I know why extended db2 error. 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)



Robert Manning wrote:

> If you have the DB2 plugin loaded, it will attempt get "human-readable"
> messages using DB2-specific classes in the JDBC driver.  Check to see
> that you have the DB2 plugin loaded (Plugins -> Summary -> Internal Name
> == db2)
>
> Rob
>
> On Fri, Feb 15, 2013 at 7:43 AM, Marcin Krol <[hidden email]
> <mailto:[hidden email]>> wrote:
>
> Hello everyone,
>
> I have specified "errors=full" in Driver properties tab in Alias
> properties, but I still get only typical error code:
>
>
> Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=OWNER,
> DRIVER=4.13.127
> SQLState:  42703
> ErrorCode: -206
>
>
> The same query when ran in db2 cmdline tool:
>
> db2 => select * from sysibm.systables  where owner = 'SAM'  and type
> = 'T';
> SQL0206N  "OWNER" is not valid in the context where it is used.
> SQLSTATE=42703
>
>
> Is there a way of getting a message accompanying error code in Squirrel?
>
>
> Regards,
> Marcin Krol

-
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
<mailto:[hidden email]>
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJRIP0CAAoJEFMgHzhQQ7hO6yMH/iJW6hkC+PdzOHHdoq2KFPgm
pPDp7IOVMHrhxetjFmQJ5SYpOJYGrGZCAHwOXQyFYA7Yc6e58D7T3khCMQ4nF+HU
1qyMoto33q2rVbHXiaNZt0FodvcqHCH7rvfhypfw93YTFPlbTo4MWUUAMyKoSXWV
Zym8cd6hXd7TAAwtCJwYPqOgVu3oYJY0yn6Ru3d9329uZxn+CkA6vo621vN4G/7i
B9plKGR13bD0hiNUngGFLLRoS1ZVyJWAW3aY9X5unh4DIzMXONtdz5kw+4nd+vhs
xOyUjcqdNjqk2KBPumGBUIViAuAA+GbvFJNnkSRShe5cPN8RmiSvtND8w7gFXfY=
=HsDZ
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users
Reply | Threaded
Open this post in threaded view
|

Re: extended error msgs when using DB2

Robert Manning
Yes, that will definitely cause the problem you are seeing.  Nice catch!  Please file a bug report here so that we can update the plugin to accept your driver name as well as the current one that it recognizes:

http://sourceforge.net/p/squirrel-sql/bugs/

Rob

On Sun, Feb 17, 2013 at 10:53 AM, Marcin Krol <[hidden email]> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello Robert,

I think I know why extended db2 error. 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)



Robert Manning wrote:
> If you have the DB2 plugin loaded, it will attempt get "human-readable"
> messages using DB2-specific classes in the JDBC driver.  Check to see
> that you have the DB2 plugin loaded (Plugins -> Summary -> Internal Name
> == db2)
>
> Rob
>
> On Fri, Feb 15, 2013 at 7:43 AM, Marcin Krol <[hidden email]
> <mailto:[hidden email]>> wrote:
>
> Hello everyone,
>
> I have specified "errors=full" in Driver properties tab in Alias
> properties, but I still get only typical error code:
>
>
> Error: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=OWNER,
> DRIVER=4.13.127
> SQLState:  42703
> ErrorCode: -206
>
>
> The same query when ran in db2 cmdline tool:
>
> db2 => select * from sysibm.systables  where owner = 'SAM'  and type
> = 'T';
> SQL0206N  "OWNER" is not valid in the context where it is used.
> SQLSTATE=42703
>
>
> Is there a way of getting a message accompanying error code in Squirrel?
>
>
> Regards,
> Marcin Krol

-
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
<mailto:[hidden email]>
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJRIP0CAAoJEFMgHzhQQ7hO6yMH/iJW6hkC+PdzOHHdoq2KFPgm
pPDp7IOVMHrhxetjFmQJ5SYpOJYGrGZCAHwOXQyFYA7Yc6e58D7T3khCMQ4nF+HU
1qyMoto33q2rVbHXiaNZt0FodvcqHCH7rvfhypfw93YTFPlbTo4MWUUAMyKoSXWV
Zym8cd6hXd7TAAwtCJwYPqOgVu3oYJY0yn6Ru3d9329uZxn+CkA6vo621vN4G/7i
B9plKGR13bD0hiNUngGFLLRoS1ZVyJWAW3aY9X5unh4DIzMXONtdz5kw+4nd+vhs
xOyUjcqdNjqk2KBPumGBUIViAuAA+GbvFJNnkSRShe5cPN8RmiSvtND8w7gFXfY=
=HsDZ
-----END PGP SIGNATURE-----


------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Squirrel-sql-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-users