python-ibmdb | Automatically exported from code.google.com/p/ibm-db
kandi X-RAY | python-ibmdb Summary
kandi X-RAY | python-ibmdb Summary
Python support for IBM DB2 and IBM Informix.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Execute an operation
- Sets the number of rows in the result set
- Prepare prepared statement
- Get the appropriate exception type
- Connect to a database
- Extracts the current schema value from a dsn
- Set the current schema
- Call a procedure
- Calls the database procedure
- Fetch multiple messages
- Return a list of IBM Extension objects
- Check if gcc is running
- Print exception message to stdout
- Set the autocommit flag
- Downloads a CLIDriver
- Drop database
- Create a new database in the database
- Get the last identity value in the system
- Create a new database
- Returns all the foreign keys in a table
- Returns a list of indexes
- Returns the primary keys in the database
- Returns a list of column names in the database
- Gets the next result set
- Fetch all tables in the database
- Creates a new database
python-ibmdb Key Features
python-ibmdb Examples and Code Snippets
Community Discussions
Trending Discussions on python-ibmdb
QUESTION
I have a requirement to use the encryptionAlgorithm and securityMechnism parameters when connecting to a DB2 database. I have not come across any information about how to include this in the connection string for ibm_db. This is how my current connection string looks:
...ANSWER
Answered 2021-Apr-01 at 12:39Both of these attributes securityMechanism
and EncryptionAlgorithm
are for JDBC/SQLJ applications only. Do not confuse a JDBC/SQLJ application with a CLI application.
Python ibm_db module does not use jdbc or java, it is written in the 'C' language and interfaces to the database via the CLI (Call Level Interface). So your python script is perceived by Db2 as a CLI application. Python ibm_db apps are not JDBC/SQLJ applications.
The connection attributes (also known as keywords) for CLI applications can differ from those of JDBC/SQLJ applications, although many are in common or have different names or values.
A CLI application can specify the AUTHENTICATION mechanism via connection-string attribute or db2dsdriver.cfg
(or for MS-Windows only via db2cli.ini
). In all cases this appears as authentication=xxxx
, where xxx is the value of the authentication which must match that of the Db2-server hosting the database to which you are connecting. In a connection string, attributes need a leading and trailing semicolon (but the very first attribute does not have a leading semicolon).
When connecting to Db2-LUW servers, currently supported IBM CLI drivers will decide (by default) the encryption automatically to be one perceived as most secure and implemented both by the CLI driver and Db2-server. That is the reason your connection succeeds without specifying these attributes.
For CLI applications you can additionally specify the algorithm with keyword/attribute ClientEncAlg=2
(meaning AES) although if you omit this the driver can choose it anyway if both sides of the connection implement the algorithm at the same key length.
For the full list of all the possible connection keywords / parameters, please refer to the Db2 online Knowledge centre for your Db2-platform and your Db2-server-version. Keywords can be version specific and Db2-server-platform specific, in addition to configuration dependent. For Db2-LUW see here.
For automatic client reroute, check the AltHostName
keyword, which can also be part of a connection string. However, for ACR, correct configuration of the Db2-server instance will allow the server to return alternate host/port details to the CLI driver on clients, as long as the CLI driver is properly maintained and kept 'current' with fixpacks. Related parameters/keywords may also need to be set for seamless failovers, refer to the docs.
So in your code, you could try:
QUESTION
In the Db2 Python driver the connect API is as follows.
...ANSWER
Answered 2021-Mar-01 at 08:07I had to be on the Db2 client with a minimum of 11.5.4. The connection string needs to have the following JWT- or token-related keywords (found in the list of CLI/ODBC configuration keywords):
- AUTHENTICATION=TOKEN
- ACCESSTOKENTYPE=JWT
- ACCESSTOKEN= with the actual JWT value
Putting it into action, the following code snippet works to successfully connect using a JWT:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install python-ibmdb
You can use python-ibmdb like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page