<!--$Id: text.so,v 10.15 2001/03/13 20:39:47 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Loading text into databases</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <a name="2"><!--meow--></a> <table width="100%"><tr valign=top> <td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Dumping and Reloading</dl></h3></td> <td align=right><a href="../dumpload/format.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../install/file.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p> <h3 align=center>Loading text into databases</h3> <p>The <a href="../../utility/db_load.html">db_load</a> utility can be used to load text into databases. The <b>-T</b> option permits nondatabase applications to create flat-text files that are then loaded into databases for fast, highly-concurrent access. For example, the following command loads the standard UNIX <b>/etc/passwd</b> file into a database, with the login name as the key item and the entire password entry as the data item:</p> <blockquote><pre>awk -F: '{print $1; print $0}' < /etc/passwd |\ sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db</pre></blockquote> <p>Note that backslash characters naturally occurring in the text are escaped to avoid interpretation as escape characters by <a href="../../utility/db_load.html">db_load</a>.</p> <table width="100%"><tr><td><br></td><td align=right><a href="../dumpload/format.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../install/file.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>