📄 onjava_com database connections and sqlj statements.htm
字号:
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>ONJava.com: Database Connections and SQLJ Statements</title> <meta name="keywords" content="ONJava.com,O'Reilly Network,oreillynet,oreillynet.com,O'Reilly,OREILLY,JDO/JDBC/SQLJ,Java,Jason Price,Jason Price,SQLJ,Java,SQL" > <meta name="description" content="Connect to a database and embed SQL statements in your Java programs with SQLJ." /> <meta name="date" content="Jan. 02, 2002" /> <meta name="pagename" content="Database Connections and SQLJ Statements" /> <meta name="site" content="ONJava.com" /> <meta name="author" content="Jason Price" /> <meta name="safariu_url" content="http://www.onjava.com/pub/a/onjava/2002/01/02/learning_sqlj.html" />
<link rel="alternate" type="application/rss+xml" title="ONJava.com Articles" href="http://www.oreillynet.com/meerkat/?_fl=rss10&t=ALL&c=5136" />
<link rel="alternate" type="application/atom+xml" title="ONJava.com Articles" href="http://www.oreillynet.com/meerkat/?_fl=atom&t=ALL&c=5136" />
<!-- sc/388 Common JavaScript -->
<script language="JavaScript" type="text/javascript" src="http://www.oreillynet.com/common.js"></script>
<noscript>
</noscript>
<link rel="STYLESHEET" type="text/css" href="http://www.oreillynet.com/styles/main.css">
<!--WEBSIDESTORY CODE HBX1.0 (Universal)--><!--COPYRIGHT 1997-2004 WEBSIDESTORY,INC. ALL RIGHTS RESERVED. U.S.PATENT No. 6,393,479B1. MORE INFO:http://websidestory.com/privacy--><script language="javascript" type="text/javascript">var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;}var hbx=_hbEvent("pv");hbx.vpc="HBX0100u";hbx.gn="ehg-oreilly.hitbox.com";hbx.acct="DM52040214SV;DM520404M4ZR"; //ACCOUNT NUMBER(S)hbx.pn="PUT+PAGE+NAME+HERE"; //PAGE NAME(S)hbx.mlc="CONTENT+CATEGORY"; //MULTI-LEVEL CONTENT CATEGORYhbx.pndef="title"; //DEFAULT PAGE NAMEhbx.ctdef="full"; //DEFAULT CONTENT CATEGORYhbx.lt="auto"; //LINK TRACKING hbx.dlf="n"; //DOWNLOAD FILTERhbx.dft="n"; //DOWNLOAD FILE NAMINGhbx.elf="n"; //EXIT LINK FILTER//SEGMENTS AND FUNNELShbx.seg=""; //VISITOR SEGMENTATIONhbx.fnl=""; //FUNNELS//CAMPAIGNShbx.cmp=""; //CAMPAIGN IDhbx.cmpn="CMP"; //CAMPAIGN ID IN QUERYhbx.hra=""; //RESPONSE ATTRIBUTEhbx.hqsr=""; //RESPONSE ATTRIBUTE IN REFERRAL QUERYhbx.hqsp=""; //RESPONSE ATTRIBUTE IN QUERYhbx.hlt=""; //LEAD TRACKINGhbx.hla=""; //LEAD ATTRIBUTEhbx.gp=""; //CAMPAIGN GOALhbx.gpn=""; //CAMPAIGN GOAL IN QUERYhbx.hcn=""; //CONVERSION ATTRIBUTEhbx.hcv=""; //CONVERSION VALUEhbx.cp="null"; //LEGACY CAMPAIGNhbx.cpd=""; //CAMPAIGN DOMAIN//CUSTOM VARIABLEShbx.ci="";//CUSTOMER IDhbx.hc1="";//CUSTOM 1hbx.hc2="";//CUSTOM 2hbx.hc3="";//CUSTOM 3hbx.hc4="";//CUSTOM 4hbx.pec="";//ERROR CODES</script><script language="javascript1.1" defer="defer" src="http://www.oreillynet.com/hbx.js" type="text/javascript"></script><!--//--><!-- END WEBSIDESTORY CODE -->
<!-- end hitbox -->
</head>
<body bgcolor="#ffffff" text="#000000" marginwidth="0" marginheight="0" leftmargin="0" rightmargin="0" topmargin="0"><!-- 389 body -->
<noindex>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="bottom"><!-- top left logo --><a href="http://www.onjava.com/"><img src="/images/onjava/onjava_logo.jpg" width="294" height="82" border="0" alt="ONJava.com -- The Independent Source for Enterprise Java" hspace="0" vspace="0" /></a></td>
<td valign="middle" align="right"><table border="0" cellspacing="0" width="468"><tr><td><!-- dy --> <iframe src="http://ad.doubleclick.net/adi/onjava.ds/wsjart;pos=top_wsjart;sz=468x60;ord=1619181744?" width="468" height="60" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"> <script type="text/javascript" language="JavaScript1.1" src="http://ad.doubleclick.net/adj/onjava.ds/wsjart;abr=!ie;pos=top_wsjart;sz=468x60;ord=1619181744?"></script> </iframe> <noscript> <a href="http://ad.doubleclick.net/jump/onjava.ds/wsjart;abr=!ie;pos=top_wsjart;sz=468x60;ord=1619181744?"><img src="http://ad.doubleclick.net/ad/onjava.ds/wsjart;abr=!ie;kw=pos=top_wsjart;sz=468x60;ord=1619181744?" border="0" width="468" height="60" alt="Advertisement" /></a> </noscript></td></tr></table>
<!-- universal art top banner ad -->
</td>
</tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<!-- tabs (generic) --><nobr><a href="http://www.oreillynet.com/"><img src="/images/tabs/orn_black.gif" alt="O'Reilly Network." width="113" height="16" hspace="0" vspace="0" border="0" /></a><a href="http://www.oreilly.com/"><img src="/images/tabs/ora_gray.gif" alt="oreilly.com" width="82" height="16" hspace="0" vspace="0" border="0" /></a><a href="http://safari.oreilly.com/"><img src="/images/tabs/safari_gray.gif" alt="Safari Bookshelf." width="114" height="16" hspace="0" vspace="0" border="0" /></a><a href="http://conferences.oreilly.com/"><img src="/images/tabs/conf_gray.gif" alt="Conferences." width="88" height="16" hspace="0" vspace="0" border="0" /></a></nobr></td>
<td align="right" class="tiny">
<nobr><a href="/cs/user/login?x-redirect=/cs/user/home">Sign In/My Account</a> | <a href="http://epoch.oreilly.com/shop/cart.orm">View Cart</a> </nobr></td>
</tr>
<tr>
<tr>
<td colspan="2" bgcolor="#ffffff">
<!-- horizontal nav (generic) --><table border="0" cellpadding="0" cellspacing="1" height="25" width="100%" bgcolor="#ffffff"><tr bgcolor="#ffffff">
<td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a href="http://www.oreillynet.com/pub/q/articles" class="nolinewhite">Articles</a></td>
<td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a href="http://weblogs.oreillynet.com/" class="nolinewhite">Weblogs</a></td>
<td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a class="nolinewhite" href="http://www.oreilly.com/catalog/">Books</a></td>
<!-- td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a class="nolinewhite" href="http://meerkat.oreillynet.com/">Meerkat Feeds</a></td -->
<td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a class="nolinewhite" href="http://learninglab.oreilly.com/">Learning Lab</a></td>
<td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a class="nolinewhite" href="http://edocuments.oreilly.com/">eDocuments</a></td>
<!-- td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a class="nolinewhite" href="http://news.oreillynet.com/">News</a></td -->
<!-- td align="center" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"><a class="nolinewhite" href="http://www.oreillynet.com/forums/">Forums</a></td -->
<td width="100%" nowrap="nowrap" bgcolor="#000000" style="padding-left: 8px; padding-right: 8px"> <!-- right-most cell (empty) --></td>
</tr></table>
</td>
</tr>
</tr>
<tr height="24">
<td colspan="2" valign="middle" bgcolor="#330066" height="24" align="center" style="border-left: 1px #FFF solid;border-right: 1px #FFF solid;">
<!-- some topics get ad -->
<!-- t a r /onjava/2002/01/02/learning_sqlj.html --><!-- 1 152 --><!-- 2 152 152 --><!-- 152 --><!-- 152 --><p class="smalllist" align="center">
<span class="tinywhite">Join us at the <a href="http://conferences.oreilly.com/oscon/" class="tinywhite">O'Reilly Mac OS X Conference</a>, October 25 - 28, in Santa Clara, CA.</span></p>
</td>
</tr>
</tr>
</table>
</noindex>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="160" rowspan="3" valign="top" bgcolor="#000000" style="border-left: 1px #FFF solid;">
<noindex>
<!-- begin left navbar -->
<table width="160" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr>
<td colspan="2" bgcolor="#000000"><img src="/images/trans.gif" alt=" " width="160" height="6" border="0" /></td>
</tr>
<tr>
<td valign="top" bgcolor="#000000" width="10"><img src="/images/trans.gif" alt="" width="10" height="10" border="0" /></td>
<td valign="top" bcolor="#000000" width="150" class="nav3">
<!-- search -->
<noindex>
<form method="get" action="http://search.atomz.com/search/" enctype="application/x-www-form-urlencoded">
<p class="smalllist"><input name="sp-q-1" type="radio" value="onjava" /> ONJava.com<br />
<input name="sp-q-1" type="radio" value="" checked /> All of O'Reilly</p>
<input type=hidden name="sp-a" value="sp1000a5a9">
<input type=hidden name="sp-t" value="cat_search">
<input type=hidden name="sp-x-1" value="collection">
<input type="text" name="sp-q" size="10" maxlength="80" /> <input type="submit" name="search" value="Go" />
<p class="smalllist"> <a class="nav3" href="/search/index.ncsp">Advanced Search »</a></p></form>
</noindex>
<!-- login -->
<p><a href="http://www.oreillynet.com/cs/user/login?x-redirect=http://www.oreillynet.com" class="nav3" title="Login to manage your newsletter subscriptions, post talkbacks as yourself, or change your profile.">Login</a><br />
<a href="/cs/user/register?x-redirect=http%3A%2F%2Fwww%2Eoreillynet%2Ecom%2Fcs%2Fuser%2Flogin%3Fx%2Dredirect%3D%252F" class="nav3" title="Create a an account.">Register</a><br />
<a href="http://www.oreillynet.com/cs/user/login?x-redirect=/cs/elists/query/q/246" class="nav3" title="Choose which newsletters you'd like to receive.">Manage Newsletters</a><br />
<a href="http://register.oreilly.com" class="nav3" title="Register Your Books.">Register Your Books</a></p>
<!-- Product Showcase -->
<p><span class="navheader">Product Showcase</span><br />
<a class="nav3" href="http://www.oreilly.com/go/bea_prodshow">BEA Learning Channel</a></p>
<!-- onjava topics -->
<span class="navheader">ONJava Topics<br />
<a class="navtab" href="/pub/q/all_onjava_articles">All Articles</a><br /><a class="navtab" href="/topics/java/Java_Design">Best Practices</a><br />
<a class="navtab" href="/topics/java/EJB">Enterprise JavaBeans</a><br />
<a class="navtab" href="/topics/java/J2EE">Java 2EE (Enterprise)</a><br />
<a class="navtab" href="/topics/java/J2SE">Java 2SE (Standard)</a><br />
<a class="navtab" href="/topics/java/java_xml">Java and XML</a><br />
<a class="navtab" href="/topics/java/jdo">Java Data Objects</a><br />
<a class="navtab" href="/topics/java/java_ide">Java IDE Tools</a><br />
<a class="navtab" href="/topics/java/Java_Media">Java Media</a><br />
<a class="navtab" href="/topics/java/Java_Security">Java Security</a><br />
<a class="navtab" href="/topics/java/javasys">Java SysAdmin</a><br />
<a class="navtab" href="/topics/java/jdbc_sqlj">JDO/JDBC/SQLJ</a><br />
<a class="navtab" href="/topics/java/JSP_Servlets">JSP and Servlets</a><br />
<a class="navtab" href="/topics/java/open_source_java">Open Source Java</a><br />
<a class="navtab" href="/topics/java/P2P_Java">P2P Java</a><br />
<a class="navtab" href="/topics/java/wsdl_uddi">Web Services</a><br />
<a class="navtab" href="/topics/java/Wireless_Java">Wireless Java</a><br />
<!-- resources -->
<p><span class="navheader">ONJava Resources</span><br />
<a class="navtab" href="/pub/q/java_os_directory">Software Directory</a><br />
<a class="navtab" href="/pub/a/onjava/api_map/">Java API Map</a><br />
<!-- affiliates -->
<p><span class="navheader">ONJava Affiliates</span><br />
<a class="navtab" href="http://www.davidflanagan.com/">davidflanagan.com</a><br />
<a class="navtab" href="http://www.java.net/">java.net</a><br />
<a class="navtab" href="http://www.jdom.org/">jdom.org</a><br />
<a class="navtab" href="http://www.servlets.com/">Servlets.com</a><br />
<br />
<!-- apple developer box -->
<!-- Apple ADC News Headlines -->
<center>
<table width="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="120" valign="top" colspan="3" bgcolor="#000000"><img src="/images/ads/adc/hotbox_top-blk.gif" alt=" " width="120" height="15" border="0" /></td>
</tr>
<tr>
<td width="120" valign="top" colspan="3" bgcolor="#000000"><a href="http://connect.apple.com"><img src="/images/ads/adc/hotbox_adc-logo.gif" alt="ADC" width="120" height="29" border="0" /></a></td>
</tr>
<tr>
<td width="10" background="/images/ads/adc/hotbox_left.gif" bgcolor="#ffffff"><img src="/images/trans.gif" height="1" width="10" border="0" alt=" " /></td>
<td width="100" valign="top" bgcolor="#ffffff"><img src="/images/trans.gif" height="1" width="100" border="0" alt="0" /><div style="font-weight: bold; font-size: 14px; font-family: lucida grande, geneva, helvetica, arial, sans-serif; margin-top: 14px; margin-bottom: 6px;">Headlines</div></td>
<td width="10" bgcolor="#ffffff" background="/images/ads/adc/hotbox_right.gif"><img src="/images/trans.gif" height="1" width="10" border="0" alt=" " /></td>
</tr>
<tr>
<td width="10" background="/images/ads/adc/hotbox_left.gif" bgcolor="#ffffff"><img src="/images/trans.gif" height="1" width="10" border="0" alt=" " /></td>
<td width="100" valign="top" bgcolor="#ffffff" bgcolor="#ffffff">
<div style="margin-bottom: 8px; font-weight: normal; font-size: 10px; line-height: 11px; font-family: lucida grande, geneva, helvetica, arial, sans-serif;">
<p class="smalllist"><a href="http://developer.apple.com/click/101904_rss1.html" onmouseover=" this.style.textDecoration='underline'; this.style.color='#ff6600'; " onmouseout=" this.style.textDecoration='none'; this.style.color='#2020ff';">New ADC Article: Tiger Developer Overview</a></p><p class="smalllist"><a href="http://developer.apple.com/click/101904_rss2.html" onmouseover=" this.style.textDecoration='underline'; this.style.color='#ff6600'; " onmouseout=" this.style.textDecoration='none'; this.style.color='#2020ff';">Mac OS X Conference Features Tiger Presentation</a></p><p class="smalllist"><a href="http://developer.apple.com/click/101904_rss3.html" onmouseover=" this.style.textDecoration='underline'; this.style.color='#ff6600'; " onmouseout=" this.style.textDecoration='none'; this.style.color='#2020ff';">Get the Tiger Early Start Kit for Developers</a></p>
</div>
<img src="/images/trans.gif" height="1" width="100" border="0" alt="0" /></td>
<td width="10" background="/images/ads/adc/hotbox_right.gif" bgcolor="#ffffff"><img src="/images/trans.gif" height="1" width="10" border="0" alt=" " /></td>
</tr>
<tr>
<td width="120" valign="top" colspan="3" bgcolor="#000000"><img src="/images/ads/adc/hotbox_bottom-blk.gif" alt="" width="120" height="10" border="0" /></td>
</tr>
</table>
</center>
<!-- end Apple ADC News Headlines -->
<br />
<!-- sites -->
<noindex>
<p><span class="navheader">Sites</span><br />
<a class="nav3" href="http://www.linuxdevcenter.com/">LinuxDevCenter.com</a><br />
<a class="nav3" href="http://www.macdevcenter.com/">MacDevCenter.com</a><br />
<a class="nav3" href="http://www.windowsdevcenter.com/">WindowsDevCenter.com</a><br />
<a class="nav3" href="http://www.oreillynet.com/mozilla/">Mozilla DevCenter</a><br />
<a class="nav3" href="http://www.ondotnet.com/">ONDotnet.com</a><br />
<a class="nav3" href="http://www.onjava.com/">ONJava.com</a><br />
<a class="nav3" href="http://www.onlamp.com/">ONLamp.com</a><br />
<a class="navtab" href="http://www.onlamp.com/apache/">Apache</a><br />
<a class="navtab" href="http://www.onlamp.com/bsd/">BSD</a><br />
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -