程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> DB2數據庫 >> DB2教程 >> DB2 connect to database連接數據報錯

DB2 connect to database連接數據報錯

編輯:DB2教程

今天應用報錯,嘗試重啟db2服務,報錯了:
[db2inst1@localhost db2dump]$ db2stop
03/16/2012 14:13:04     0   0   SQL1025N  The database manager was not stopped because databases are still active.
SQL1025N  The database manager was not stopped because databases are still active.

之後執行強制關閉:
[db2inst1@localhost db2dump]$ db2stop force
03/16/2012 14:14:52     0   0   SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.
關閉成功了

再次啟動數據庫:
[db2inst1@localhost db2dump]$ db2start    
03/16/2012 14:15:00     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

然後連接數據庫報錯了:
[db2inst1@localhost db2dump]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 9.7.5

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => connect to newhis
SQL0752N  Connecting to a database is not permitted within a logical unit of
work when the CONNECT type 1 setting is in use.  SQLSTATE=0A001
類連接設置時,在邏輯工作單元內不允許連接數據庫。
解釋:
發出 COMMIT 或 ROLLBACK
語句之前,嘗試連接另一個數據庫或同一個數據庫。在 CONNECT 1
類環境內不能處理該請求。
退出執行reset
重新執行就可以了,

[db2inst1@localhost ~]$ db2 connect reset
[db2inst1@localhost db2dump]$ db2 connect to newhis

 
   Database Connection Information

 Database server        = DB2/LINUX 9.7.5
 SQL authorization ID   = DB2INST1
 Local database alias   = NEWHIS

一切正常了
[db2inst1@localhost db2dump]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 9.7.5

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => connect to newhis

   Database Connection Information

 Database server        = DB2/LINUX 9.7.5
 SQL authorization ID   = DB2INST1
 Local database alias   = NEWHIS



作者 longqidong

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved