db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scotsmat...@apache.org
Subject svn commit: r553588 - /db/derby/docs/trunk/src/adminguide/radminnsdatasourcexmp.dita
Date Thu, 05 Jul 2007 18:14:39 GMT
Author: scotsmatrix
Date: Thu Jul  5 11:14:38 2007
New Revision: 553588

URL: http://svn.apache.org/viewvc?view=rev&rev=553588
Log:
Derby-2851: Updated example. Patch contributed by me.

Modified:
    db/derby/docs/trunk/src/adminguide/radminnsdatasourcexmp.dita

Modified: db/derby/docs/trunk/src/adminguide/radminnsdatasourcexmp.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/adminguide/radminnsdatasourcexmp.dita?view=diff&rev=553588&r1=553587&r2=553588
==============================================================================
--- db/derby/docs/trunk/src/adminguide/radminnsdatasourcexmp.dita (original)
+++ db/derby/docs/trunk/src/adminguide/radminnsdatasourcexmp.dita Thu Jul  5 11:14:38 2007
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+
 <!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
  "../dtd/reference.dtd">
 <!-- 
@@ -23,31 +24,21 @@
 <refbody>
 <section><p>The following example uses <codeph>org.apache.derby.jdbc.ClientDataSource</codeph>
to
 access the Network Server:</p></section>
-<example> <codeblock>public static javax.sql.DataSource getDS(String database,
String user, String
-password) throws SQLException
-{
-org.apache.derby.jdbc.ClientDataSource ds =
+<example> <codeblock>org.apache.derby.jdbc.ClientDataSource ds =
    new org.apache.derby.jdbc.ClientDataSource();
-
-// DatabaseName can include <ph conref="../conrefs.dita#prod/productshortname"></ph>
URL Attributes
-ds.setDatabaseName(<i>database</i>);
-
-if (user != null)
-   ds.setUser(<i>user</i>);
-if (password != null)
-   ds.setPassword(<i>password</i>);
+ds.setDatabaseName(<i>"mydb</i>);
+ds.setCreateDatabase("create");  
+ds.setUser("user");  
+ds.setPassword("mypass"); 
 
 // The host on which Network Server is running
 ds.setServerName("localhost");
 
-// port on which Network Server is listening
+// The port on which Network Server is listening
 ds.setPortNumber(1527);
 
-return ds;
-}
+Connection conn = ds.getConnection(); 
+
 </codeblock></example>
-<section><p>The program then can connect: <codeblock>javax.sql.DataSource
ds = getDS("mydb;create=true", null, null);
-// Note:  user and password are required on connection
-Connection conn = ds.getConnection("usr2", "pass2");</codeblock></p></section>
 </refbody>
 </reference>



Mime
View raw message