Advertisement
Guest User

Untitled

a guest
Mar 5th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. No suitable driver found for jdbc:derby:AddressBook
  2.  
  3. public class Test {
  4. public static final String DERBY_HOME = "derby.system.home";
  5.  
  6. // ***** the two Strings below will be different for you *****
  7. public static final String DERBY_HOME_PATH = "D:/DerbyDB";
  8. private static final String DB_NAME = "sample";
  9.  
  10. public static void main(String[] args) {
  11. System.setProperty(DERBY_HOME, DERBY_HOME_PATH);
  12. Connection conn = null;
  13. try {
  14. Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
  15. conn = DriverManager.getConnection("jdbc:derby:" + DB_NAME);
  16.  
  17. } catch (InstantiationException | IllegalAccessException
  18. | ClassNotFoundException | SQLException e) {
  19. e.printStackTrace();
  20. } finally {
  21. if (conn == null) {
  22. System.exit(-1);
  23. }
  24. }
  25.  
  26. // .... etc...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement