Connecting to a Data Source Using an IDD

Step 5: Reporting status

Each connection object is responsible for reporting its current status through its getStatus method. The status is reported as an integer, whose value is a logical OR of the flags defined in K2.driver.DriverStatusI. Your connection object must report a status of IDLE when it's ready to accept queries, and not before. This means if you're going to initialize in a separate thread, the connection object should report a status of INITIALIZING until initialization is complete, then switch to IDLE.

While your connection object is executing a query (or getting a result type), for both native and K2 queries, it should return a status of PROCESSING_QUERY. This is the signal to the execution engine that the connection is in use, and it should use another connection from the pool, or wait until this connection is free. When your object is done processing, its status should return to IDLE.

After your connection object's close method has been called, it must return CONNECTION_CLOSED for the remainder of the life of the object.


[Tech Docs Index]