Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void connect()
- {
- System.out.print("DerbyConnection: Loading Driver..");
- try
- {
- Class.forName(driver).newInstance();
- System.out.println("DONE.");
- } catch (ClassNotFoundException e)
- {
- System.err.println("\nDerbyConnection: Driver (" + driver
- + ") not found. [ClassNotFoundException]");
- e.printStackTrace(System.err);
- } catch (InstantiationException e)
- {
- System.err.println("\nDerbyConnection: Driver (" + driver
- + ") could not be loaded. [InstantiationException]");
- e.printStackTrace(System.err);
- } catch (IllegalAccessException e)
- {
- System.err.println("\nDerbyConnection: Driver (" + driver
- + ") could not be loaded. [IllegalAccessException]");
- e.printStackTrace(System.err);
- }
- System.out.print("DerbyConnection: Connecting to database ..");
- try
- {
- conn = DriverManager.getConnection(protocol + dbName
- + ";create=true;user=targas;password=swp");
- System.out.println("DONE.");
- conn.setAutoCommit(false);
- } catch (SQLException e)
- {
- System.err
- .println("\nDerbyConnection: Could not connect to database ("
- + dbName + "). [SQLException]");
- printSQLException(e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement