急!打开数据库连接超过10次就报错(在线等,解决马上结)

prowastrel 2003-10-15 04:18:19
同一应用程序打开数据库连接(Open DSN时)超过10次就报错:[IBM][CLI Driver]CLI0129E No more handles.SQLSTATE=S1014
我使用的是DB2 v7,请问如何解决,这个"10"在何处设置?
...全文
93 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
db2boy 2003-10-15
  • 打赏
  • 举报
回复
再给你贴段帮助。

Handle Freeing in CLI Applications
Environment Handle

Prior to calling SQLFreeHandle() with a HandleType of SQL_HANDLE_ENV, an application must call SQLFreeHandle() with a HandleType of SQL_HANDLE_DBC for all connections allocated under the environment. Otherwise, the call to SQLFreeHandle() returns SQL_ERROR and the environment remains valid, as well as any connection associated with that environment.

Connection Handle

If a connection is open on the handle, an application must call SQLDisconnect() for the connection prior to calling SQLFreeHandle() with a HandleType of SQL_HANDLE_DBC. Otherwise, the call to SQLFreeHandle() returns SQL_ERROR and the connection remains valid.

Statement Handle

A call to SQLFreeHandle() with a HandleType of SQL_HANDLE_STMT frees all resources that were allocated by a call to SQLAllocHandle() with a HandleType of SQL_HANDLE_STMT. When an application calls SQLFreeHandle() to free a statement that has pending results, the pending results are discarded. When an application frees a statement handle, DB2 CLI frees all the automatically generated descriptors associated with that handle.

Note that SQLDisconnect() automatically drops any statements and descriptors open on the connection.

Descriptor Handle

A call to SQLFreeHandle() with a HandleType of SQL_HANDLE_DESC frees the descriptor handle in Handle. The call to SQLFreeHandle() does not release any memory allocated by the application that may be referenced by the deferred fields (SQL_DESC_DATA_PTR, SQL_DESC_INDICATOR_PTR, and SQL_DESC_OCTET_LENGTH_PTR) of any descriptor record of Handle. When an explicitly allocated descriptor handle is freed, all statements that the freed handle had been associated with revert to their automatically allocated descriptor handle.

Note that SQLDisconnect() automatically drops any statements and descriptors open on the connection. When an application frees a statement handle, DB2 CLI frees all the automatically generated descriptors associated with that handle.

db2boy 2003-10-15
  • 打赏
  • 举报
回复
应该是占用句柄太多又没有释放的问题
db2boy 2003-10-15
  • 打赏
  • 举报
回复
调用 SQLFreeEnv、SQLFreeConnect 或 SQLFreeStmt以释放在应用程序中不再使用的某些句柄。

5,889

社区成员

发帖
与我相关
我的任务
社区描述
IBM DB2 是美国IBM公司开发的一套关系型数据库管理系统,它主要的运行环境为UNIX(包括IBM自家的AIX)、Linux、IBM i(旧称OS/400)、z/OS,以及Windows服务器版本
社区管理员
  • DB2
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧