Establishing a Connection
The objects available within our connector are accessible from the "cdata.DB2" module. In order to use the module's objects directly, the module must first be imported as below:
import cdata.DB2 as mod
From there, the connect() method can be called from the connector object to establish a connection using an appropriate connection string, such as the below:
Set the following properties to connect to DB2:
- Server: Set this to the name of the server running DB2.
- Port: Set this to the port the DB2 server is listening on.
- Database: Set this to the name of the DB2 database.
- User: Set this to the username of a user allowed to access the database.
- Password: Set this to the password of a user allowed to access the database.