FileDocCategorySizeDatePackage
DatabaseConnector.javaAPI DocExample946Wed Apr 05 20:05:26 BST 2006None

DatabaseConnector

public class DatabaseConnector extends Object

Fields Summary
Constructors Summary
Methods Summary
public static java.sql.ConnectiongetConnection()

         Logger log4j = Logger.getLogger("error");
           log4j.setLevel(Level.INFO);
	        Connection con = null;
	        String driver = "com.mysql.jdbc.Driver";
	        try {
	            Class.forName(driver).newInstance();

	        } catch (Exception e) {
	            System.out.println("Failed to load mySQL driver.");
              log4j.info("couldn't load the driver");
              e.printStackTrace();
          }
	        try {
	            con = DriverManager
	                    .getConnection("jdbc:mysql:///AJAX?user=ajax&password=aardvark");

	        } catch (Exception e) {
	            e.printStackTrace();
	        }
	        return con;