ibmdb / vscode-extension

vscode extenstion for db2 as db2connect
7 stars 2 forks source link

Need to be able to specify JDBC Parameters in connection profiles #64

Closed ahilden closed 1 year ago

ahilden commented 1 year ago

Steps to Reproduce:

In order to connect to Db2 datebases sometimes you need to specify the securityMechinism and encryptionAlgorithm or possibly other JDBC parameters. It would be great if this plugin accepted a JDBC driver string like:

jdbc:db2://somehost.com:50000/SAMPLE:user=admin;password=pwd;securityMechanism=9;encryptionAlgorithm=2;
bimalkjha commented 1 year ago

@ahilden db2connect extension do not support JDBC keywords. It support ODBC keywords. You can use ODBC connection string for db2connection as accepted by SQLDriverConnect() ODBC API as documented here: https://www.ibm.com/docs/en/db2/11.5?topic=functions-sqldriverconnect-function-cli-connect-data-source#r0000584__title__7

db2connect extension also reads the database configuration keywords from db2cli.ini and db2dsdriver.cfg file. Check IBM Db2 documentation for more details about these files.

So, use of JDBC style connection url is invalid for this extension. Many JDBC keywords have different name for db2connect extension and it will not work as used in JDBC. The securityMechanism and encryptionAlgorithm keywords are unknown for ODBC and db2connect extension. For securityMechanism=9;encryptionAlgorithm=2;, just use Authentication=SERVER_ENCRYPT; in connection string.

Instead of shared jdbc connection url, use below connection string with this connection:

Database=SAMPLE;HostName=somehost.com;Port=50000;UID=admin;PWD=db2pass;Authentication=SERVER_ENCRYPT;

Thanks.