{"action":"closed","issue":{"url":"https://api.github.com/repos/ibmdb/python-ibmdb/issues/212","repository_url":"https://api.github.com/repos/ibmdb/python-ibmdb","labels_url":"https://api.github.com/repos/ibmdb/python-ibmdb/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/ibmdb/python-ibmdb/issues/212/comments","events_url":"https://api.github.com/repos/ibmdb/python-ibmdb/issues/212/events","html_url":"https://github.com/ibmdb/python-ibmdb/issues/212","id":148108670,"number":212,"title":"\"Column information cannot be retrieved\" - error after reconnecting to database","user":{"login":"lintonv","id":8958894,"avatar_url":"https://avatars.githubusercontent.com/u/8958894?v=3","gravatar_id":"","url":"https://api.github.com/users/lintonv","html_url":"https://github.com/lintonv","followers_url":"https://api.github.com/users/lintonv/followers","following_url":"https://api.github.com/users/lintonv/following{/other_user}","gists_url":"https://api.github.com/users/lintonv/gists{/gist_id}","starred_url":"https://api.github.com/users/lintonv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lintonv/subscriptions","organizations_url":"https://api.github.com/users/lintonv/orgs","repos_url":"https://api.github.com/users/lintonv/repos","events_url":"https://api.github.com/users/lintonv/events{/privacy}","received_events_url":"https://api.github.com/users/lintonv/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-04-13T16:05:17Z","updated_at":"2016-09-08T21:28:42Z","closed_at":"2016-09-08T21:28:42Z","body":"**Here is the code Path:**\r\nIn Python Flask webserver - \r\n\r\n**STEP 1 -  connect to database, restart docker DB2 container, so check if the connection is active and reconnect**\r\n```\r\nif ibm_db.active(databaseConnection) is False:\r\n    del databaseConnection\r\n    databaseConnection = ibm_db.connect(conn_str, ' ', ' ')\r\n```\r\n            \r\n**STEP 2 -  prepare statement**\r\n```\r\nsql_string = \"select * from <table_name>\"\r\nstmt = self.ibm_db.prepare(databaseConnection, sql_string)\r\n```\r\n\r\n**STEP 3 -  bind parameters**\r\n`ibm_db.bind_param(stmt, 0, \"some_test_variable\")`\r\n\r\n**STEP 4 -  execute DB2 statement**\r\n`ibm_db.execute(stmt)`\r\n\r\n**STEP 5 - Try to fetch row**\r\n```\r\nif ibm_db.fetch_row(stmt) is False:\r\n      <use ibm_db.result() to get some results - BUT FAILS BEFORE HERE>\r\n```\r\n\r\nCode works always when the connection is NOT reset. As soon as db2 container is restarted (or goes down) and the connection is re-established successfully, trying to fetch_row fails with the exception below. The reconnect, prepare, bind and execute all WORK and complete successfully (at least no errors are seen). But trying to fetch a row raises an exception. \r\n\r\n\r\n**Here is the error**\r\n`Exception: Column information cannot be retrieved:`\r\n\r\n**Here is the setup:**\r\n\r\n- Running db2express in a Docker Container\r\nhttps://hub.docker.com/r/ibmcom/db2express-c/\r\n\r\n- If the container restarts and the connection to DB2 is re-established by calling \"ibm_db.connect()\", ibm_db.fetch_row(resource_stmt) fails\r\n\r\n**Environment**\r\nName: ibm-db\r\nVersion: 2.0.6\r\nSummary: Python DBI driver for DB2 (LUW, zOS, i5) and IDS\r\nHome-page: http://pypi.python.org/pypi/ibm_db/\r\nAuthor: IBM Application Development Team\r\nAuthor-email: opendev@us.ibm.com\r\nLicense: Apache License 2.0\r\nLocation: /usr/local/lib/python2.7/site-packages"}}
{"actor":{"display_login":"lintonv"}}