You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cs...@apache.org on 2007/01/02 18:43:05 UTC

svn commit: r491867 - /beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/system-controls/jdbc/tutorial.xml

Author: cschoett
Date: Tue Jan  2 09:43:04 2007
New Revision: 491867

URL: http://svn.apache.org/viewvc?view=rev&rev=491867
Log:
Update for BEEHIVE-1167, doc change to JDBC system control tutorial, describing new setConnection api.
Contributed by Drew Varner, Thanks Drew.

Modified:
    beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/system-controls/jdbc/tutorial.xml

Modified: beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/system-controls/jdbc/tutorial.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/system-controls/jdbc/tutorial.xml?view=diff&rev=491867&r1=491866&r2=491867
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/system-controls/jdbc/tutorial.xml (original)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/system-controls/jdbc/tutorial.xml Tue Jan  2 09:43:04 2007
@@ -59,11 +59,30 @@
             <section>
                 <title>Connecting to a Database Instance</title>
                 <p> The next step is to tell the JdbcControl how to connect to a database instance.  
-                        This is done using class level Java annotations, there are two annotations which can be used:</p>
+                        This is done using class level Java annotations, there are two annotations which may be used:</p>
                 <ul>
                         <li>JdbcControl.ConnectionDriver</li>
                         <li>JdbcControl.ConnectionDataSource</li>
                 </ul>
+		<p></p>
+                <p>It is possible to use a JdbcControl without declaraing a connection source via annotations. The
+                        following example shows how to set the connection for a JdbcControl without connection 
+                        annotations. The <code>setConnection()</code> api can also be used to override
+                        the connection specified in a control's annotations.</p>
+                <source>
+public class Bar {
+    @Control
+    NoConnectionAnnotationCtrl noConnectionAnnotationCtrl;
+    
+    public void useControlWithoutConnectionAnnotations() throws Exception {
+        Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+        Connection conn = DriverManager.getConnection("jdbc:derby:MyDB;create=true");
+        noConnectionAnnotationCtrl.setConnection(conn);
+        Foo foo = noConnectionAnnotationCtrl.getFooById(123);
+        conn.close();
+    }
+}
+                </source>
 
                 <p>(i) See the JDBC Control Annotation Reference for additional information about these annotations.</p>
             </section>