DB2 XML Plugin

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

DB2 XML Plugin

Lars.Heller

Dear SQuirreL Team.

we are using your great tool together with a db2 v9.1 database. Since we
use the xml features of this database, we would like to have xml results
displayed correctly. Currently SQuirreL displays "<Sonstiges>" ("other"
;-)) in the view, which isn't very useful to us. If there isn't any plugin
available we would write one or enhance the existing db2 plugin. In that
case, how and where should we start?

Thanks for any help and hints!

Regards,
Lars
______________________________________________________

Cedros Gesellschaft fuer Datenverarbeitung mbH
Siegburger Strasse 35 . D-53757 Sankt Augustin
Telefon +49 (0)22 41-88 34-0 . Telefax +49 (0)22 41-88 34 11
Geschaeftsfuehrung: Armin Dreiling, Markus Michels USt-ID DE123113291;
Registergericht: Amtsgericht Siegburg, HR B 3526
______________________________________________________

Diese E-Mail kann vertrauliche und/oder rechtlich geschuetzte
Informationen enthalten und ist nur fuer die Person bestimmt, an die
adressiert wurde. Sollten Sie diese Nachricht irrtuemlich erhalten
haben, untersagen wir, diese zu verteilen, zu veroeffentlichen,
auszudrucken oder zu speichern. Bitte benachrichtigen Sie den
Absender ueber den irrtuemlichen Erhalt und loeschen Sie diese E-Mail
von jedem Computer.

This e-mail may contain confidential and/or legally protected
information and is only intended for the person it is addressed to.
If you have received this message in error, it is prohibited to copy,
disclose, publish, print or save it. You should notify the sender and
delete this message from all computers.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Re: DB2 XML Plugin

Gerd Wagner-3
Hi Lars,


[hidden email] wrote:
> Dear SQuirreL Team.
>
> we are using your great tool together with a db2 v9.1 database.
Thanks a lot.


> Since we
> use the xml features of this database, we would like to have xml results
> displayed correctly. Currently SQuirreL displays "<Sonstiges>" ("other"
> ;-)) in the view, which isn't very useful to us. If there isn't any plugin
> available we would write one or enhance the existing db2 plugin. In that
> case, how and where should we start?
First please have a look at
http://squirrel-sql.sourceforge.net/index.php?page=programing

At the bottom of this page there are links to an PDF document. (The document is
available in three languages). At the bottom of this document you find a rather
detailed description of an example how to build a Plugin. The example is even
based on DB2 so you are lucky in a way.

Since there already is an existing DB2 Plugin for SQuirreL you are to decide if
you'd like to add your XML features to this Plugin or create a new Plugin. At
first sight I'd advice you to try to add to the existing Plugin.

Hope this helps.

Gerd


>
> Thanks for any help and hints!
>
> Regards,
> Lars
> ______________________________________________________
>
> Cedros Gesellschaft fuer Datenverarbeitung mbH
> Siegburger Strasse 35 . D-53757 Sankt Augustin
> Telefon +49 (0)22 41-88 34-0 . Telefax +49 (0)22 41-88 34 11
> Geschaeftsfuehrung: Armin Dreiling, Markus Michels USt-ID DE123113291;
> Registergericht: Amtsgericht Siegburg, HR B 3526
> ______________________________________________________
>
> Diese E-Mail kann vertrauliche und/oder rechtlich geschuetzte
> Informationen enthalten und ist nur fuer die Person bestimmt, an die
> adressiert wurde. Sollten Sie diese Nachricht irrtuemlich erhalten
> haben, untersagen wir, diese zu verteilen, zu veroeffentlichen,
> auszudrucken oder zu speichern. Bitte benachrichtigen Sie den
> Absender ueber den irrtuemlichen Erhalt und loeschen Sie diese E-Mail
> von jedem Computer.
>
> This e-mail may contain confidential and/or legally protected
> information and is only intended for the person it is addressed to.
> If you have received this message in error, it is prohibited to copy,
> disclose, publish, print or save it. You should notify the sender and
> delete this message from all computers.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Squirrel-sql-develop mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Re: DB2 XML Plugin

Robert Manning
On Wed, Feb 27, 2008 at 8:19 PM, Gerd Wagner <[hidden email]> wrote:

>  [hidden email] wrote:
>  > Since we
>  > use the xml features of this database, we would like to have xml results
>  > displayed correctly. Currently SQuirreL displays "<Sonstiges>" ("other"
>  > ;-)) in the view, which isn't very useful to us. If there isn't any plugin
>  > available we would write one or enhance the existing db2 plugin. In that
>  > case, how and where should we start?
>  First please have a look at
>  http://squirrel-sql.sourceforge.net/index.php?page=programing
>
>  At the bottom of this page there are links to an PDF document. (The document is
>  available in three languages). At the bottom of this document you find a rather
>  detailed description of an example how to build a Plugin. The example is even
>  based on DB2 so you are lucky in a way.

Lars,

Let me re-iterate Gerd's suggestion here to add to the existing
plugin.  All plugins have the ability to define custom type handlers
by implementing the IDataTypeComponent and registering the custom type
handler with the CellComponentFactory during initialization.  For
example, the Oracle plugin does already handle the XML type in Oracle.
 For example, the code in OraclePlugin.java is:

         CellComponentFactory.registerDataTypeFactory(
             new OracleXmlTypeDataTypeComponentFactory() , 2007,
             "SYS.XMLTYPE");

We use the factory pattern instead of a concrete implementation class
so that SQuirreL core can create the custom type for columns with Type
= 2007 whenever it needs to.  When your custom handler will only be
used for sessions that have the same dialect type you specify in
IDataTypeComponentFactory, so there is no problem with registering
different custom handlers that handler the same type.  This plugin API
is also documented here:

http://squirrel-sql.wiki.sourceforge.net/SQuirreL+SQL+Client+Plugin+API

Let us know if you run into any issues that don't seem to be handled
well by the existing custom type handler plugin API.  We can always
modify the API, if it is found to be lacking.

Rob

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: DB2 XML Plugin

Lars.Heller
Thanks for your assistance. No I am in need for some further help. :-)

I used the mentioned OracleXmlTypeDataTypeComponent as a template along
with the factory and registered it in DB2Plugin#initialize()

        CellComponentFactory.registerDataTypeFactory(
            new DB2XmlTypeDataTypeComponentFactory() , Types.OTHER, "XML");

Type and type name are from DB2 manual and are displayed that way in the
ResulSetMetaData when running a query in Squirrel.

Now, when executing a query I  still receive "<Other>" in the value field.
Debugging showed me, that ColumnDefintions are correctly created, my custom
data type is registered (e.g. component factory's construct is called). But
when loading data, my DB2XmlTypeDataTypeComponent#readResultSet method
never gets called.

Further debugging showed me, that SQLExecutorTask#processResultSet() leads
to ResultSetDataSet#setResultSet(ResultSet, String, int[], boolean,
boolean, DialectType), where the ResultSet is read by a ResultSetReader
(ResultSetDataSet line 170) ignoring the column defitinions (method param "
useColumnDefs" is false in this call hierarchy).

Am I missing something here?
______________________________________________________

Cedros Gesellschaft fuer Datenverarbeitung mbH
Siegburger Strasse 35 . D-53757 Sankt Augustin
Telefon +49 (0)22 41-88 34-0 . Telefax +49 (0)22 41-88 34 11
Geschaeftsfuehrung: Armin Dreiling, Markus Michels USt-ID DE123113291;
Registergericht: Amtsgericht Siegburg, HR B 3526
______________________________________________________

Diese E-Mail kann vertrauliche und/oder rechtlich geschuetzte
Informationen enthalten und ist nur fuer die Person bestimmt, an die
adressiert wurde. Sollten Sie diese Nachricht irrtuemlich erhalten
haben, untersagen wir, diese zu verteilen, zu veroeffentlichen,
auszudrucken oder zu speichern. Bitte benachrichtigen Sie den
Absender ueber den irrtuemlichen Erhalt und loeschen Sie diese E-Mail
von jedem Computer.

This e-mail may contain confidential and/or legally protected
information and is only intended for the person it is addressed to.
If you have received this message in error, it is prohibited to copy,
disclose, publish, print or save it. You should notify the sender and
delete this message from all computers.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Re: DB2 XML Plugin

Robert Manning
On Thu, Feb 28, 2008 at 7:27 AM,  <[hidden email]> wrote:

> Thanks for your assistance. No I am in need for some further help. :-)
>
>  I used the mentioned OracleXmlTypeDataTypeComponent as a template along
>  with the factory and registered it in DB2Plugin#initialize()
>
>         CellComponentFactory.registerDataTypeFactory(
>             new DB2XmlTypeDataTypeComponentFactory() , Types.OTHER, "XML");
>
>  Type and type name are from DB2 manual and are displayed that way in the
>  ResulSetMetaData when running a query in Squirrel.
>
>  Now, when executing a query I  still receive "<Other>" in the value field.
>  Debugging showed me, that ColumnDefintions are correctly created, my custom
>  data type is registered (e.g. component factory's construct is called). But
>  when loading data, my DB2XmlTypeDataTypeComponent#readResultSet method
>  never gets called.
>
>  Further debugging showed me, that SQLExecutorTask#processResultSet() leads
>  to ResultSetDataSet#setResultSet(ResultSet, String, int[], boolean,
>  boolean, DialectType), where the ResultSet is read by a ResultSetReader
>  (ResultSetDataSet line 170) ignoring the column defitinions (method param "
>  useColumnDefs" is false in this call hierarchy).
>
>  Am I missing something here?

In your DB2XmlTypeDataTypeComponent,  what is returned for getDialect ?

Rob

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Antwort: Re: Re: DB2 XML Plugin

Lars.Heller
> In your DB2XmlTypeDataTypeComponent,  what is returned for getDialect ?

DialectType.DB2


______________________________________________________

Cedros Gesellschaft fuer Datenverarbeitung mbH
Siegburger Strasse 35 . D-53757 Sankt Augustin
Telefon +49 (0)22 41-88 34-0 . Telefax +49 (0)22 41-88 34 11
Geschaeftsfuehrung: Armin Dreiling, Markus Michels USt-ID DE123113291;
Registergericht: Amtsgericht Siegburg, HR B 3526
______________________________________________________

Diese E-Mail kann vertrauliche und/oder rechtlich geschuetzte
Informationen enthalten und ist nur fuer die Person bestimmt, an die
adressiert wurde. Sollten Sie diese Nachricht irrtuemlich erhalten
haben, untersagen wir, diese zu verteilen, zu veroeffentlichen,
auszudrucken oder zu speichern. Bitte benachrichtigen Sie den
Absender ueber den irrtuemlichen Erhalt und loeschen Sie diese E-Mail
von jedem Computer.

This e-mail may contain confidential and/or legally protected
information and is only intended for the person it is addressed to.
If you have received this message in error, it is prohibited to copy,
disclose, publish, print or save it. You should notify the sender and
delete this message from all computers.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Re: DB2 XML Plugin

Robert Manning
2008/2/28  <[hidden email]>:
> > In your DB2XmlTypeDataTypeComponent,  what is returned for getDialect ?
>
>  DialectType.DB2
>

It looks to me like a bug at line 163 ResultSetDataSet:

rdr = new ResultSetReader(rs, null);

instead should be:

rdr = new ResultSetReader(rs, dialectType);

This prevents the call to
CellComponentFactory.readResultWithPluginRegisteredDataType from
passing in the dialect type (it is null) .  Since the dialect type is
null, the default IDataTypeComponent is used.  Somehow when I was
refactoring to support pluggable type handlers,  I made the API change
that was needed, but I apparently neglected to hookup the new
argument. Can you try the change above and let us know if it helps?

Rob

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Re: DB2 XML Plugin

Lars.Heller
> It looks to me like a bug at line 163 ResultSetDataSet:
>
> rdr = new ResultSetReader(rs, null);
>
> instead should be:
>
> rdr = new ResultSetReader(rs, dialectType);
>

Yep, that worked! I'll send you a patch file containing the plugin
extension and the bug fix.
______________________________________________________

Cedros Gesellschaft fuer Datenverarbeitung mbH
Siegburger Strasse 35 . D-53757 Sankt Augustin
Telefon +49 (0)22 41-88 34-0 . Telefax +49 (0)22 41-88 34 11
Geschaeftsfuehrung: Armin Dreiling, Markus Michels USt-ID DE123113291;
Registergericht: Amtsgericht Siegburg, HR B 3526
______________________________________________________

Diese E-Mail kann vertrauliche und/oder rechtlich geschuetzte
Informationen enthalten und ist nur fuer die Person bestimmt, an die
adressiert wurde. Sollten Sie diese Nachricht irrtuemlich erhalten
haben, untersagen wir, diese zu verteilen, zu veroeffentlichen,
auszudrucken oder zu speichern. Bitte benachrichtigen Sie den
Absender ueber den irrtuemlichen Erhalt und loeschen Sie diese E-Mail
von jedem Computer.

This e-mail may contain confidential and/or legally protected
information and is only intended for the person it is addressed to.
If you have received this message in error, it is prohibited to copy,
disclose, publish, print or save it. You should notify the sender and
delete this message from all computers.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop
Reply | Threaded
Open this post in threaded view
|

Re: Patch file (was: DB2 XML Plugin)

Robert Manning
In reply to this post by Robert Manning
This patch that provides support for DB2 XML types is in CVS now.

Cheers,

Rob

2008/2/29  <[hidden email]>:
> Hi Rob,
>
>  here is the patch file containing the changes i made.
>
>  Thanks for your help and have a nice day :-)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Squirrel-sql-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop