University of Cincinnati logo and link  
Making a Database Bean
 
  UC ingot Let's make a bean that proxies the database classes we've used thus far.  Then, we can deploy this in a Swing app.  Perhaps we could even make a Swing component that uses this to display the results of database queries!  
  • To make life easy, let's start with what Sun gave us and adapt it to a database class.
    • Add the necessary import statement: java.sql.*;
    • Then, make instance fields for Connection, Statement, and ResultSet.
    • Make the getters and setters for these instance fields.
    • Make the manifest file.  Watch out, my IDE was very particular about this!
    • Make the jar file.
    • Import the jar into your IDE.
    • Make a Swing form and test it out.
    • This will be a non-GUI bean, because we can't see it on the form but we can still add it to the form and set properties.
 The Source