惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
博客园 - 司徒正美
F
Fortinet All Blogs
D
Docker
aimingoo的专栏
aimingoo的专栏
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
U
Unit 42
The Register - Security
The Register - Security
Martin Fowler
Martin Fowler
IT之家
IT之家
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
月光博客
月光博客
Apple Machine Learning Research
Apple Machine Learning Research
Security Archives - TechRepublic
Security Archives - TechRepublic
Project Zero
Project Zero
T
Tenable Blog
S
Security Affairs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google DeepMind News
Google DeepMind News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
W
WeLiveSecurity
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Tailwind CSS Blog
TaoSecurity Blog
TaoSecurity Blog
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
雷峰网
雷峰网
Forbes - Security
Forbes - Security
Recent Announcements
Recent Announcements
N
News | PayPal Newsroom
Schneier on Security
Schneier on Security
酷 壳 – CoolShell
酷 壳 – CoolShell
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
P
Palo Alto Networks Blog
C
Cybersecurity and Infrastructure Security Agency CISA
S
Schneier on Security
Attack and Defense Labs
Attack and Defense Labs
Latest news
Latest news
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
Last Week in AI
Last Week in AI
Scott Helme
Scott Helme
A
Arctic Wolf
L
LINUX DO - 最新话题
A
About on SuperTechFans
K
Kaspersky official blog
博客园 - Franky

博客园 - XiaoHui

windbg tips windbg无法下载pdb调试符号 unix/linux tips freebsd中xorg 7.4键盘反应迟顿的问题 Django升级到1.0以后的一些变化 ubuntu安装新字体 诡异的修改首页--00333.cn/alei.htm 使用nmap扫描内网在线机器的MAC地址 [转载]HOWTO 使用 vim 的 minibuf 来切换缓冲区 - XiaoHui rtorrent无法完全支持中文的解决办法 EFLAGES寄存器中的系统标志 How to manually create a crash dump file 因网络限制而无法连接MS的symbol服务器的解决办法 NEG+SBB指令组合的用处 Nt*与Zw*的区别 Image与Base64String的互转换 编程实现清除temp1.exe,temp2.exe木马 类似Acdsee的东东,不过是用.NET的。 AIHear 0.1.2
python连接数据库
XiaoHui · 2009-09-08 · via 博客园 - XiaoHui

postgresql:

使用psycopg2来连接

示例代码:

1 import psycopg2
2 
3 conn = psycopg2.connect("dbname='dbname' user='username' host='localhost' password='password'")
4 cur = conn.cursor()
5 cur.execute("select * from dbtable")
6 for row in cur:
7     print row[0]
8 conn.close()

ms sql server:

使用pymssql来连接

示例代码:

 1 import psmssql
 2 
 3 conn = psmssql.connect(host='yourhost', user='loginname', password='password', database='dbname', charset='utf8')
 4 cur = conn.cursor()
 5 cur.execute('select * from dbtable')
 6 
 7 for row in cur:
 8     print row[0]
 9 
10 conn.close()