{"id":18510641,"url":"https://github.com/liuzl/db2","last_synced_at":"2026-05-07T06:35:41.045Z","repository":{"id":80656746,"uuid":"143092709","full_name":"liuzl/db2","owner":"liuzl","description":"DB2 with pandas","archived":false,"fork":false,"pushed_at":"2018-08-02T03:20:17.000Z","size":25,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-25T20:26:13.761Z","etag":null,"topics":["db2","docker","mac","pandas"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liuzl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-01T02:18:48.000Z","updated_at":"2018-09-27T08:35:15.000Z","dependencies_parsed_at":"2023-06-12T10:00:08.505Z","dependency_job_id":null,"html_url":"https://github.com/liuzl/db2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuzl%2Fdb2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuzl%2Fdb2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuzl%2Fdb2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liuzl%2Fdb2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liuzl","download_url":"https://codeload.github.com/liuzl/db2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239225766,"owners_count":19603162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["db2","docker","mac","pandas"],"created_at":"2024-11-06T15:24:13.928Z","updated_at":"2025-10-31T19:30:24.863Z","avatar_url":"https://github.com/liuzl.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 使用docker安装db2环境\n\n```sh\n# 拉取db2的docker镜像\ndocker pull ibmcom/db2express-c\n\n# 启动docker\ndocker run --name DB2ExpressC -d -p 50000:50000 -e DB2INST1_PASSWORD=db2inst1 -e LICENSE=accept  ibmcom/db2express-c:latest db2start\n\n# 进入到启动的容器\ndocker exec -it DB2ExpressC /bin/bash\n\n# 切换用户到 db2inst1\nsu - db2inst1\n\n# 安装默认实例\ndb2sampl\n\n# 连接到新创建的数据库实例\ndb2 connect to sample\n\n# 执行SQL\ndb2 \"SELECT * FROM STAFF\"\n```\n\n## Python连接db2\n\n```python\nimport ibm_db\nconn = ibm_db.connect(\"DATABASE=sample;HOSTNAME=localhost;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=db2inst1;\", \"\", \"\")\nsql = \"SELECT * FROM STAFF\"\nstmt = ibm_db.exec_immediate(conn, sql)\nresult = ibm_db.fetch_both(stmt)\nwhile result:\n    print(result)\n    result = ibm_db.fetch_both(stmt)\n```\n\n## db2常见命令\n```sh\n$ #连接数据库\n$ db2 connect to sample\n$ #列出数据表\n$ db2 list tables\n$ #列出系统表\n$ db2 list tables for system\n$ #列出所有表\n$ db2 list tables for all \n$ #列出用户表\n$ db2 list tables for user\n$ #显示表结构\n$ db2 describe table tablename\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuzl%2Fdb2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliuzl%2Fdb2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliuzl%2Fdb2/lists"}