⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 139.html

📁 Python Ebook Python&XML
💻 HTML
字号:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Robots" content="INDEX,NOFOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<TITLE>Safari | Python Developer's Handbook -&gt; Working with Databases</TITLE>
<LINK REL="stylesheet" HREF="oreillyi/oreillyN.css">
</HEAD>
<BODY bgcolor="white" text="black" link="#990000" vlink="#990000" alink="#990000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="100%" cellpadding=5 cellspacing=0 border=0 class="navtopbg"><tr><td><font size="1"><p class="navtitle"><a href="8.html" class="navtitle">Web Development</a> &gt; <a href="0672319942.html" class="navtitle">Python Developer's Handbook</a> &gt; <a href="137.html" class="navtitle">8. Working with Databases</a> &gt; <span class="nonavtitle">Working with Databases</span></p></font></td><td align="right" valign="top" nowrap><font size="1"><a href="main.asp?list" class="safnavoff">See All Titles</a></font></td></tr></table>
<TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="138.html" title="8. Working with Databases"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=139" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="139.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="140.html" title="Flat Databases"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
<a href="5%2F31%2F2002+4%3A38%3A32+PM.html" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><font color=white size=1>152015024128143245168232148039199167010047123209178152124239215162147044209056133069164150</font><a href="read9.asp?bookname=0672319942&snode=139&now=5%2F31%2F2002+4%3A38%3A32+PM" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><br>
<FONT>
				<h3>
			Working with Databases</h3>
				<p>For simplicity, let's say that databases are summarized as the place where you store and update data. Python is able to connect to a wide variety of databases.</p>

				<P>The simplest solution to handle databases in Python is to use plain text files. A tiny variation of this method is to store the information in binary format.</P>

				<P>The next possible solution is to use the indexing mechanism provided by the dbm-like modules. This mechanism provides better performance than our first option because it automatically organizes the data. It works by implementing dictionary structures that are used to store information. This option enables you to encode Python objects, and efficiently archive them in indexed files without having to go through the details of parsing and unparsing the information.</P>

				<p>For this reason, object serialization and persistence storing are also present in this chapter. Both concepts are very helpful when it comes to storing information. Their roles are to translate Python objects to strings before archiving them to the file system or before transferring them to another process.</p>

				<p>The last solution is to use "real" databases'systems by importing third-party database extension modules, such as the native Python interfaces to MySQL, Oracle, and Sybase database systems.</p>

				<P>If your database doesn't have a native interface to Python, don't worry. Python also offers ODBC extensions that will enable you to connect to any database that supports ODBC, and as you know, almost all database servers have ODBC drivers available nowadays.</P>

				<P>In the worst-case scenario, many client/server database systems provide C libraries that connect to their databases. If you are a dedicated hacker, you can create extension modules that talk to these C libraries connecting to the database.</P>

				<p>For more information about using databases versus Python, check Python's Web site at the following URL:</p>

				<p>
					<a TARGet="_blank" href="http://www.python.org/topics/database/">http://www.python.org/topics/database/</a>
					<a name="idx1073744833"></a>
				</p>

			</font>
<P><TABLE width="100%" border=0><TR valign="top"><TD><font size=1 color="#C0C0C0"><br></font></TD><TD align=right><font size=1 color="#C0C0C0">Last updated on 1/30/2002<br>Python Developer's Handbook, &copy;&nbsp;2002 Sams Publishing</font></TD></TR></TABLE></P>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="138.html" title="8. Working with Databases"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=139" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="139.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="140.html" title="Flat Databases"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
</TD></TR></TABLE>
<br><TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD><H4 class=Title>Index terms contained in this section</H4>
<font size=2>
 <a href="#idx1073744833">databases</a><BR>
<BR>
</font></TD></TR></TABLE>




<!--EndOfBrowse-->

</TD></TR></TABLE>
<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#990000><tr><td><p align=center><font size=1 face="verdana,arial,helvetica" color=white>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -