commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgra...@apache.org
Subject cvs commit: jakarta-commons-sandbox/dbutils/xdocs navigation.xml todo.xml index.xml
Date Thu, 23 Oct 2003 03:41:14 GMT
dgraham     2003/10/22 20:41:14

  Added:       dbutils/xdocs navigation.xml todo.xml index.xml
  Log:
  Added xdocs.
  
  Revision  Changes    Path
  1.1                  jakarta-commons-sandbox/dbutils/xdocs/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <project name="DbUtils">
  
    <title>DbUtils</title>
    <organizationLogo href="/images/jakarta-logo-blue.gif">Jakarta</organizationLogo>
  
    <body>
      <menu name="DbUtils">
        <item name="Overview" href="/index.html"/>
        <item name="To Do List" href="/todo.html"/>
      </menu>
    </body>
  </project>
  
  
  
  1.1                  jakarta-commons-sandbox/dbutils/xdocs/todo.xml
  
  Index: todo.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <document>
    <properties>
      <title>TODO</title>
      <author email="dgraham@apache.org">David Graham</author>
    </properties>
  
    <body>
      <section name="TODO"> 
        <p>
          The following is a list of items that need to be completed in
          DbUtils.  Contributions are welcome!.
        </p>
        
  <table border="1">
  
    <tr>
      <th>Action Item</th>
      <th>Volunteer</th>
    </tr>
  
    <tr>
      <td>
          <strong>Documentation</strong> - Provide more examples and site info.
      </td>
      <td align="center"></td>
    </tr>
    <tr>
      <td>
          Dynamic wrappers for JDBC interfaces.
      </td>
      <td align="center"></td>
    </tr>
    <tr>
      <td>
          More test cases.
      </td>
      <td align="center"></td>
    </tr>
  
  </table>
  
      </section>
    </body>
  </document>
  
  
  
  
  1.1                  jakarta-commons-sandbox/dbutils/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <document>
  
   <properties>
    <title>JDBC Utility Component</title>
    <author email="dgraham@apache.org">David Graham</author>
   </properties>
  
  <body>
  
  <section name="DbUtils: JDBC Utility Component">
  
  <section name="Purpose">
  <p>
  DbUtils is a small set of classes designed to make working with 
  <a href="http://java.sun.com/products/jdbc/">JDBC</a> easier.  JDBC 
  resource cleanup code is mundane, error prone work so these classes 
  abstract out all of the cleanup tasks from your code leaving you with
  what you really wanted to do with JDBC in the first place: query and 
  update data.
  </p>
  
  <p>Some of the advantages of using DbUtils are:</p>
  <ul>
  	<li>
  	    No possibility for resource leaks.  Correct JDBC coding isn't 
  	    difficult but it is time-consuming and tedious.  This often 
  	    leads to connection leaks that maybe difficult to track down.
  	</li>
  	<li>
      	Cleaner, clearer persistence code.  The amount of code needed 
      	to persist data in a database is drastically reduced. The remaining 
      	code clearly expresses your intention without being cluttered 
      	with resource cleanup.
  	</li>
  </ul>
  
  </section>
  
  
  <section name="Scope of the Package">
  <p>
  DbUtils is designed to be:
  </p>
  <ul>
      <li>
          <strong>Small</strong> - you should be able to understand the 
          whole package in a short amount of time.
      </li>
      <li>
          <strong>Transparent</strong> - DbUtils doesn't do any magic 
          behind the scenes.  You give it a query, it executes it and 
          cleans up for you.
      </li>
      <li>
          <strong>Fast</strong> - You don't need to create a million 
          temporary objects to work with DbUtils.
      </li>
  </ul>
  
  <p>
  DbUtils is <strong>not</strong>:
  </p>
  <ul>
      <li>
          An Object/Relational bridge - there are plenty of good O/R tools
          already.  DbUtils is for developers looking to use JDBC without all
          the mundane pieces.  
      </li>
      <li>
          A Data Access Object (DAO) framework - DbUtils can be used to build
          a DAO framework though.
      </li>
      <li>
          An object oriented abstraction of general database
          objects like a Table, Column, or PrimaryKey.
      </li>
      <li>
          A heavyweight framework of any kind - the goal here is to be a 
          straightforward and easy to use JDBC helper library.
      </li>
  </ul>
  
  </section>
  
  <section name="Example Usage">
  <p>
  The core classes in DbUtils are 
  <code><a href="apidocs/org/apache/commons/dbutils/QueryRunner.html">QueryRunner</a></code>
  and
  <code><a href="apidocs/org/apache/commons/dbutils/ResultSetHandler.html">ResultSetHandler</a></code>
  The following example demonstrates how these classes are used together.
  </p>
  
  <pre>
  DataSource ds = // somehow get DataSource;
  
  // 1.  Configure QueryRunner with the DataSource
  // Note that QueryRunner has methods that take a 
  // java.sql.Connection so you are not required to
  // use DataSources.
  QueryRunner run = new QueryRunner(ds);
  
  // 2.  Implement the ResultSetHandler interface or use
  // one of the provided implementations.  This one converts a 
  // ResultSet row into a bean.
  ResultSetHandler h = new BeanHandler(Person.class);
  
  // 3.  Execute the SQL statement with one replacement parameter and
  // return the results in a new Person object (generated by the handler
  // in step 2).
  Person p = (Person) run.query("SELECT * FROM Person WHERE name=?", "John Doe", h); 
  </pre>
  
  </section>
  
  <section name="Interaction With Other Packages">
      <p>DbUtils relies on these packages:</p> 
      <ul>
          <li>Java 1.2 (or later)</li>
          <li>JDBC 1.2 (or later)</li>
      </ul>
  </section>
  
  </body>
  </document>
  
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message