title: What Design Pattern is Useful for Communicating With Database
body: <p>I need a Design Pattern that is good for communicating with a Database.</p>
  
  <p>I want an object that is used by different subsystems of the software to communicate with the Database. This object will have all the MySQL queries in functions. </p>
  
  <p>For example:</p>
  
  <pre><code>class DatabaseController
  {
     getAllUsers()
     {
       // Access the Database and get all the UserNames.
     }
  
     findUserID(String id)
     {
        // Look in the User Table in MySQL database.
     }
  
     findItem(String itemName)
     {
        // Look in the item's table in MySQL database.
     }
  }
  </code></pre>
  
  <p>I was thinking of a Singleton, so that I would provide just one entry point to the DatabaseController.</p>
  
  <p><strong>Is there superior design pattern that will allow other classes to communicate with the DatabaseController and has functionality designed for communicating with Databases?</strong></p>
  
  <p>Different parts of the software will call, for example.</p>
  
  <pre><code>class ItemController
  {
    findItem(String itemName)
    {
       DatabaseController.findItem(itemName);
    }
  }
  </code></pre>
  
  <p>[EDIT]
  I am looking for something to write myself, possibly looking at a tutorial, and in Java.</p>