dbeaver / cloudbeaver

Cloud Database Manager
https://dbeaver.com/
Apache License 2.0
3.52k stars 382 forks source link

Trying to add Db2 for z/OS #394

Closed monsters4r closed 3 years ago

monsters4r commented 3 years ago

I followed the doc at - https://cloudbeaver.io/docs/Adding-new-database-drivers/ and rebuilt cloudbeaver, but I don't see Db2 for z/OS as an option when I go to add a database manually (obviously a scan doesn't work because it's a remote database).

When starting cloudbeaver, I see

2021-06-22 18:46:44.756 - Available drivers: DB2 LUW,Firebird,H2 Embedded,Derby Server,SQLite,Trino,MS SQL Server / SQL Server,MySQL,MariaDB,Oracle,PostgreSQL

so it's not picking up z/OS. I used the same (funky) naming convention that DBeaver uses for the z/OS plugin (db2.zos) - don't know if the naming could be part of the issue or not. Everything compiled fine.

Any thoughts/pointers?

Thanks

kseniiaguzeeva commented 3 years ago

Could you please give me more details in order to I could to assess the issue? What exactly do you do/steps to reproduce?

monsters4r commented 3 years ago

Hi - Since Db2 for z/OS was already supported in DBeaver using the same JDBC driver as Db2 LUW, I simply took the LUW support in CloudBeaver and cloned it.

So I followed the steps in the link above - titled "Adding drivers in CloudBeaver"

Under server/drivers - I added a "db2.zos" directory with a pom.xml file that was identical to the Db2 Luw pom.xml with the exception of ...

4.0.0
<artifactId>drivers.db2</artifactId>
<version>1.0.1</version>
<parent>

...

Because build had an issue with the same driver and same version (I just renamed to version 1.01 and build was happy) - it built a "drivers.db2-1.0.1.jar file" in the "target/maven-archiver"

I then followed these instructions

Open file server/bundles/io.cloudbeaver.resources.drivers.base/plugin.xml

I added the following lines (the ... denotes the lines I added in context they are not there in the actual code).

    <resource name="drivers/db2"/>
    **<resource name="drivers/db2.zos"/>**
    <resource name="drivers/mysql/mysql8"/>

    <bundle id="drivers.db2" label="DB2 drivers"/>
    **<bundle id="drivers.db2.zos" label="DB2 z/OS drivers"/>**
    <bundle id="drivers.mysql" label="MySQL drivers"/>

    <driver id="db2:db2"/>
    **<driver id="generic:db2.zos"/>**
    <driver id="mysql:mysql8"/>

I then rebuild CloudBeaver (everything was ok) and ran from the deploy folder.

I went to create a connection to Db2 for z/OS and was not given Db2 for z/OS as an option (although, I can see Db2 for z/OS in severa of the build steps).

I'll be honest - I expected to get an error on connect because Db2 for z/OS requires a license jar - but never got to that point. If I got to the point I got the license issue, I was going to work on that.

monsters4r commented 3 years ago

Any thoughts on how to move forward here?

serge-rider commented 3 years ago
monsters4r commented 3 years ago

That worked - thx. I do understand that Db2 for z/OS is a special case, but missed the subtleness that Db2 for z/OS would not need it's own bundle resource bindings.
Part of this was because the Db2 for z/OS plugin.xml file (that you reference above) lists ... id="db2_zos" parent="generic" ...

But LUW (in the db2.xml file) doesn't have a parent.

This sort of led me to believe that they were not common.

I was able to connect to z/OS by simply placing the license jar file in the ~drivers/db2/target directory.

Thanks again