📄 onjava_com database connections and sqlj statements.htm
字号:
<a class="navtab" href="http://www.onlamp.com/onlamp/general/mysql.csp">MySQL</a><br />
<a class="navtab" href="http://www.onlamp.com/php/">PHP</a><br />
<a class="navtab" href="http://www.onlamp.com/python/">Python</a><br />
<a class="navtab" href="http://www.onlamp.com/security/">Security</a><br />
<a class="nav3" href="http://www.openp2p.com/">OpenP2P.com</a><br />
<a class="nav3" href="http://www.perl.com/">Perl.com</a><br />
<a class="nav3" href="http://www.oreillynet.com/policy/">Policy DevCenter</a><br />
<a class="nav3" href="http://oreilly.wirelessdevnet.com/">Wireless DevCenter</a><br />
<a class="nav3" href="http://www.xml.com/">XML.com</a><br />
<a class="navtab" href="http://webservices.xml.com/">WebServices.XML.com</a></p>
</noindex>
<noindex>
<p><span class="navheader">Affiliate Sites</span><br />
<a class="nav3" href="http://www.linuxquestions.org/">LinuxQuestions.org</a><br />
<a class="nav3" href="http://www.mobilewhack.com/">MobileWhack</a><br />
<a class="nav3" href="http://www.osdir.com/">OSDir.com</a><br />
<a class="nav3" href="http://servlets.com/">Servlets.com</a></p>
</noindex>
<img src="/images/trans.gif" alt="" width="10" height="5" border="0" /><br />
<table border="0" cellpadding="1" cellspacing="0" width="136">
<tr><td bgcolor="#336699">
<table border="0" cellpadding="0" cellspacing="0" width="136">
<tr><td><a href="http://www.developershed.com/" target="_new"><img src="/images/ads/dev-shed.gif" alt="Developer Resources Partner" width="136" height="21" border="0" /></a>
<div style="background:#336699; margin-right:4px; padding:2px; font-weight:normal;" class="nav">
<ul style="margin:0;padding-left:1.6em;list-style-image:url;">
<li style="margin-bottom:0.1em;"><a href="http://www.devshed.com" class="nav" style="text-decoration: underline" target="_new">Open Source</a></li>
<li style="margin-bottom:0.1em;"><a href="http://www.aspfree.com" class="nav" style="text-decoration: underline" target="_new">ASP Help</a></li>
<li style="margin-bottom:0.1em;"><a href="http://www.devarticles.com" class="nav" style="text-decoration: underline" target="_new">Developer Tutorials</a></li>
<li style="margin-bottom:0.1em;"><a href="http://www.devhardware.com" class="nav" style="text-decoration: underline" target="_new">Computer Hardware</a></li>
<li style="margin-bottom:0.1em;"><a href="http://www.SEOChat.com" class="nav" style="text-decoration: underline" target="_new">Search Engine Optimization</a></li>
<li style="margin-bottom:0.1em;"><a href="http://www.scripts.com" class="nav" style="text-decoration: underline" target="_new">Scripts</a></li>
</ul>
</div>
</td></tr></table>
</td></tr></table>
<img src="/images/trans.gif" alt="" width="10" height="5" border="0" /><br />
<!-- resource centers -->
<noindex>
<p><span class="navheader">Resource Centers</span><br />
<a href="http://bio.oreilly.com/" class="nav3">Bioinformatics</a><br />
<a href="http://cprog.oreilly.com/" class="nav3">C/C++</a><br />
<a href="http://databases.oreilly.com/" class="nav3">Databases</a><br />
<a href="http://digitalmedia.oreilly.com/" class="nav3">Digital Media</a><br />
<a href="http://enterprisedev.oreilly.com/" class="nav3">Enterprise Development</a><br />
<a href="http://gamedev.oreilly.com/" class="nav3">Game Development</a><br />
<a href="http://java.oreilly.com/" class="nav3">Java</a><br />
<a href="http://linux.oreilly.com/" class="nav3">Linux/Unix</a><br />
<a href="http://mac.oreilly.com/" class="nav3">Macintosh/OS X</a><br />
<a href="http://dotnet.oreilly.com/" class="nav3">.NET</a><br />
<a href="http://opensource.oreilly.com/" class="nav3">Open Source</a><br />
<a href="http://oracle.oreilly.com/" class="nav3">Oracle</a><br />
<a href="http://perl.oreilly.com/" class="nav3">Perl</a><br />
<a href="http://python.oreilly.com/" class="nav3">Python</a><br />
<a href="http://scripting.oreilly.com/" class="nav3">Scripting</a><br />
<a href="http://security.oreilly.com/" class="nav3">Security</a><br />
<a href="http://networking.oreilly.com/" class="nav3">SysAdm/Networking</a><br />
<a href="http://web.oreilly.com/" class="nav3">Web</a><br />
<a href="http://webservices.oreilly.com/" class="nav3">Web Services</a><br />
<a href="http://windows.oreilly.com/" class="nav3">Windows</a><br />
<a href="http://wireless.oreilly.com/" class="nav3">Wireless</a><br />
<a href="http://xml.oreilly.com/" class="nav3">XML</a>
</p>
</noindex>
<!-- rss -->
<p><a href="http://www.oreillynet.com/meerkat/?_fl=atom&t=ALL&c=5136"><img src="/images/icons/atom.gif" alt="Atom Feed" width="80" height="15" border="0" vspace="10" /></a><br />
<a href="http://www.oreillynet.com/meerkat/?_fl=rss10&t=ALL&c=5136"><img src="/images/icons/rss1.gif" alt="RSS Feed" width="80" height="15" border="0" /></a><br />
<a href="http://www.oreillynet.com/meerkat/?_fl=rss10&t=ALL&c=5136" class="nav3">RSS Feed</a><br />
<a href="http://oreillynet.com/getorn.csp" class="nav3">Using our RSS Feeds</a></p>
<!-- oreilly books -->
<img src="/images/related_books.gif" alt="Related O'Reilly Books" width="140" height="23" /><div style="background:#ddd; margin-right:10px; padding:2px; font-weight:normal;" class="smalltext"><ul style="margin:0 2px 0 0;padding-left:1.6em;list-style-image:url(/images/bullet_arrow.gif);"><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/aspectjckbk/">AspectJ Cookbook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/bfljava/">Better, Faster, Lighter Java</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/eclipse/">Eclipse</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/eclipseckbk/">Eclipse Cookbook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/entjbeans4/">Enterprise JavaBeans, 4th Edition</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/hardcorejv/">Hardcore Java</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/hfdesignpat/">Head First Design Patterns</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/hfjejb/">Head First EJB</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/headservletsjsp/">Head First Servlets and JSP</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/hibernate/">Hibernate: A Developer's Notebook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/j2eedp/">J2EE Design Patterns</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/jakartackbk/">Jakarta Commons Cookbook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/javaadn/">Java 5.0 Tiger: A Developer's Notebook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/0596007019/">Java Cookbook, 2nd Edition</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/jenut3/">Java Examples in a Nutshell, 3rd Edition</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/javanp3/">Java Network Programming, 3rd Edition</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/jsvltjspckbk/">Java Servlet & JSP Cookbook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/jthreads3/">Java Threads, 3rd Edition</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/059600821X/">Java vs .NET Security (PDF)</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/jsvrfaces/">JavaServer Faces</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/jserverpages3/">JavaServer Pages, 3rd Edition</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/junitpg/">JUnit Pocket Guide</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/0596006519/">Programming Jakarta Struts, 2nd Edition</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/quicktimejvaadn/">QuickTime for Java: A Developer's Notebook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/realwws/">Real World Web Services</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/swtadn/">SWT: A Developer's Notebook</a></li><li style="margin-bottom:0.5em;"><a href="http://www.oreilly.com/catalog/weblogictdg/">WebLogic: The Definitive Guide</a></li></ul>
</div>
<br />
<br /></td>
</tr>
<tr>
<td colspan="2" valign="top" bgcolor="#000000">
<!-- sponsored links -- generic for all oreillynet.com and devcenters (domain-level sites have their own) -->
<table cellpadding="2" cellspacing="1" align="center" bgcolor="#efefef">
<tr>
<td height="10" align="center" bgcolor="#000099" class="tinywhite">Traveling to<br />
a tech show?</td></tr>
<tr><td>
<table cellpadding="3" cellspacing="0" style="border-width: 1px; border-style: solid; border-color: #efefef;">
<tr>
<td bgcolor="#efefef" width="125"> <p class="tinywhite"><a href="http://www.lasvegas-discounthotels.com">Las
Vegas Hotels</a><br />
<a href="http://www.freehotelsearch.com">Discount Hotels</a><br />
<a href="http://www.birmingham.al.usa.freehotelguide.com/">Birmingham
Hotels</a><br />
<a href="http://www.freehotelsearch.com/us/New_York-hotels/New_York-hotels.html">Hotels
New York City</a><br />
<a href="http://www.freehotelsearch.com/international/Puerto_Rico-hotels.html">Puerto
Rico Hotels</a><br />
<a href="http://www.canadianhotelguide.com/ca/Ontario-hotels/Mississauga-hotels.html">Mississauga
Hotels</a><br />
<a href="http://www.freehotelsearch.com/us/Nevada-hotels/Las_Vegas-hotels.html">Las
Vegas Hotels & Packages</a><br />
<a href="http://www.freehotelsearch.com/international/Mexico-hotels.html">Hotels
in Mexico</a><br />
</p>
</td>
</tr>
</table></td></tr></table>
<br /><br /><br />
<noindex>
<table cellpadding="2" cellspacing="1" align="center" bgcolor="#efefef">
<tr>
<td height="10" align="center" bgcolor="#000099" class="tinywhite">ONJava.com<br /> supported by:</td></tr>
<tr><td>
<table cellpadding="3" cellspacing="0" style="border-width: 1px; border-style: solid; border-color: #efefef;">
<tr>
<td bgcolor="#efefef" width="125">
<p class="tinywhite"><a href="http://www.loanapplicationstoday.com">Refinance Options</a><br /> <a href="http://www.loanapplicationstoday.com">Online</a><br />
<a href="http://home-insurance.easycfm.com">Home Insurance Quotes</a><br />
</p>
</td>
</tr>
</table></td></tr></table>
</noindex><br />
<img src="/images/trans.gif" alt=" " width="150" height="6" border="0" />
</td>
</tr>
</table>
<!-- end left navbar -->
</noindex>
</td>
<td width="10" valign="top">
<img src="/images/trans.gif" alt=" " width="10" height="1"></td>
<!-- content here -->
<td width="100%" valign="top"><img src="/images/trans.gif" alt=" " width="1" height="10"><br />
<!-- begin discuss-print-email-spanish-blog options --><table cellspacing="1" cellpadding="0" border="0" align="right" width="70"><!-- code to add print option --><tr><td rowspan="99"> <!-- spacer column --></td><td align="right" width="18"><a class="secondary" title="Go to a print-friendly version of this page." href="/lpt/a/1341"><img src="/images/icons/print_18.gif" width="18" height="18" hspace="3" vspace="0" alt="Print." border="0" /></a></td><td align="left" class="secondary" nowrap><a class="secondary" title="Go to a print-friendly version of this page." href="/lpt/a/1341">Print</a></td></tr><!-- code to add email option --><tr><td align="right" width="18"><a class="secondary" title="Send a link to this article to a friend." href="mailto:?subject=Database Connections and SQLJ Statements&body=http://www.onjava.com/pub/a/onjava/2002/01/02/learning_sqlj.html?page=2"><img src="/images/icons/mail_18.gif" width="18" height="18" hspace="3" vspace="0" border="0" alt="Email." /></a></td><td align="left" class="secondary" nowrap><a class="secondary" title="Send a link to this article to a friend." href="mailto:?subject=Database Connections and SQLJ Statements&body=http://www.onjava.com/pub/a/onjava/2002/01/02/learning_sqlj.html?page=2">Email article link</a></td></tr><!-- code add discuss option --><!-- code to add trackbacks link --><tr><td align="right" width="18"><a class="secondary" title="Trackbacks" href="/pub/a/onjava/2002/01/02/learning_sqlj.html?page=last#trackbacks"><img src="/images/icons/trackback_18.gif" width="18" height="18" hspace="3" vspace="0" alt="Trackbacks." border="0" /></a></td><td align="left" class="secondary" nowrap><a class="secondary" title="View trackbacks for this article." href="/pub/a/onjava/2002/01/02/learning_sqlj.html?page=last#trackbacks">Trackbacks</a></td></tr><!-- code to add spanish option --><!-- code to add blog this option --><tr><td align="right" width="18"><a class="secondary" title="Get info to copy for a weblog post." href="http://www.oreillynet.com/cs/user/print/a/1341?x-t=blog_this.view" onClick="window.open('/cs/user/print/a/1341?x-t=blog_this.view','Blogthis','toolbar=no,width=600,height=400,status=no,location=no,scrollbars=yes,resizable=yes,menubar=yes');return false"><img src="/images/icons/blog_18.gif" width="18" height="18" hspace="3" vspace="0" border="0" alt="Blog this." /></a></td><td align="left" class="secondary" nowrap><a class="secondary" title="Get info to copy for a weblog post." href="http://www.oreillynet.com/cs/user/print/a/1341?x-t=blog_this.view" onClick="window.open('http://www.oreillynet.com/cs/user/print/a/1341?x-t=blog_this.view','Blogthis','toolbar=no,width=600,height=400,status=no,location=no,scrollbars=yes,resizable=yes,menubar=yes');return false">Blog this</a></td></tr></table><!-- end discuss-print-email-spanish-blog options --><!-- begin trackback --><!-- commented out so page will still validate --><!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"><rdf:Description rdf:about="http://www.onjava.com/pub/a/onjava/2002/01/02/learning_sqlj.html?page=2" dc:identifier="http://www.onjava.com/pub/a/onjava/2002/01/02/learning_sqlj.html?page=2" dc:title="Database Connections and SQLJ Statements" trackback:ping="http://www.oreillynet.com/cs/user/trackback/cs_msg?x-lr=cs_disc/&x-lr2=a/1341&x-a=submit&trackback=1" /></rdf:RDF> --><!-- end trackback --><!-- content here --> <!-- mega preparse mp:yes -->
<p class="secondary"><b>Database Connections and SQLJ Statements</b><br />
Pages: <a href="/pub/a/onjava/2002/01/02/learning_sqlj.html?page=1">1</a>, <b>2</b>, <a href="/pub/a/onjava/2002/01/02/learning_sqlj.html?page=3">3</a>
</p>
<h4>Database URL Structure</h4>
<p>The database URL tells SQLJ where your database is located. The structure of the database URL is dependent on the brand of JDBC driver being used. In the case of the Oracle's JDBC drivers, the URL structure is as follows:</p><pre><br clear="all" /><table border="0" cellpadding="8" cellspacing="0" align="center" width="336"><tr><td><!-- dy --> <iframe src="http://ad.doubleclick.net/adi/onjava.ds/jdbcart;pos=mega_jdbcart;sz=336x280;ord=1435754367?" width="336" height="280" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"> <script type="text/javascript" language="JavaScript1.1" src="http://ad.doubleclick.net/adj/onjava.ds/jdbcart;abr=!ie;pos=mega_jdbcart;sz=336x280;ord=1435754367?"></script> </iframe> <noscript> <a href="http://ad.doubleclick.net/jump/onjava.ds/jdbcart;abr=!ie;pos=mega_jdbcart;sz=336x280;ord=1435754367?"><img src="http://ad.doubleclick.net/ad/onjava.ds/jdbcart;abr=!ie;kw=pos=mega_jdbcart;sz=336x280;ord=1435754367?" border="0" width="336" height="280" alt="Advertisement" /></a> </noscript></td></tr></table><br clear="all" /><code>driver_name:@driver_specific_information</code></pre>
<p>The syntax elements are as follows:</p>
<dl>
<dt>
<strong>driver_name</strong>
</dt>
<dd>
<p>Specifies the name of the Oracle JDBC driver that you want to use. This may be any one of the following:</p>
<dl><dt>
<code>jdbc:oracle:thin</code>
</dt>
<dd>
Oracle JDBC Thin driver (for Oracle7 and above)
</dd>
<dt>
<code>jdbc:oracle:oci</code>
</dt>
<dd>
Oracle JDBC OCI driver (for Oracle9i and above)
</dd>
<dt>
<code>jdbc:oracle:oci8</code>
</dt>
<dd>
Oracle JDBC OCI8 driver (for Oracle8i and Oracle8)
</dd>
<dt>
<code>jdbc:oracle:oci7</code>
</dt>
<dd>
Oracle JDBC OCI7 driver (for Oracle7)
</dd>
</dl><br />
</dd>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -