Objects and Classes
Static fields and methods
Use
A class that uses a static initialization block
public class ProductDB { private static Connection connection; // static variable // the static initialization block static { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:MurachProducts"; String user = "Admin"; String password = ""; connection = DriverManager.getConnection(url, user, password); } catch (Exception e) { System.out.println( "Error connecting to database."); } } // static methods that use the Connection object public static Product get(String code){} public static boolean add(Product product){} public static boolean update(Product product){} public static boolean delete(String code){} }