Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class database {
- public static String databaseName;
- public static String username;
- public static String password;
- public String tableName;
- public String schema;
- public String query;
- ResultSet rs;
- public static Connection dbconnection;
- public database(String databaseName, String username, String password) throws Exception {
- this.databaseName = databaseName;
- this.username = username;
- this.password = password;
- }
- public database() throws Exception{
- databaseName = "database";
- username = "admin";
- password = "12345";
- // TODO Auto-generated constructor stub
- }
- // Connect to selected Cache Database
- public static Connection connect() throws Exception {
- try {
- // Default port is 1972
- String url = "jdbc:Cache://127.0.0.1:1972/" + databaseName;
- Class.forName("com.intersys.jdbc.CacheDriver").newInstance();
- dbconnection = DriverManager.getConnection(url, username, password);
- System.out.println("Connected to " + databaseName + " database.");
- } catch (Exception e) {
- e.printStackTrace();
- }
- return dbconnection;
- }
- }
- public class features {
- database db = new database();
- Connection conn = db.connect();
- ResultSet rs;
- Statement st = conn.createStatement();
- }
Add Comment
Please, Sign In to add comment