User:Gap.cap/sandbox

/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package controllers;

/** * * @author Gautam */ import java.io.*; import java.sql.*;

public class ConnectionFactory {

private static ConnectionFactory con = new ConnectionFactory; String driverClass = "sun.jdbc.odbc.JdbcOdbcDriver"; String conUrl = "jdbc:odbc:travelopaedia"; String uname = "Gautam"; String pass = "ilovejava";

private ConnectionFactory { try { Class.forName(driverClass); } catch (ClassNotFoundException cnfe) { }   }

public static ConnectionFactory getInstance { return con; }

public Connection getConnection throws SQLException { Connection connection = DriverManager.getConnection(conUrl, uname, pass); return connection; } }