Advertisement
Guest User

Untitled

a guest
Apr 15th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. public static Connection getdataconnet() {
  2. Connection connect = null;
  3. try {
  4. Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
  5. connect = DriverManager.getConnection("jdbc:derby:APPDATA", "xxxx", "xxxxxxxxxxxxxxx");
  6. } catch (ClassNotFoundException ex) {
  7. globalData.GlobalDataSetGet.OLD_USER = -1;
  8. ////JOptionPane.showMessageDialog(null, "1"+ex);
  9. } catch (SQLException ex) {
  10. globalData.GlobalDataSetGet.OLD_USER = -1;
  11. ////JOptionPane.showMessageDialog(null, "2"+ex);
  12. }
  13. return connect;
  14. }
  15.  
  16. Connection connect = null;
  17. Path currentRelativePath = Paths.get("");
  18. String s = currentRelativePath.toAbsolutePath().toString();
  19. try {//DriverManager.getConnection("jdbc:derby:"+System.getProperty("user.dir")+"/APPDATA", "#####", "#############");
  20. connect = DriverManager.getConnection("jdbc:derby:"+s+"/APPDATA", "#####", "#############");
  21.  
  22. } catch (ClassNotFoundException ex) {
  23. globalData.GlobalDataSetGet.OLD_USER = -1;
  24. JOptionPane.showMessageDialog(null, "1"+ex);
  25. } catch (SQLException ex) {
  26. globalData.GlobalDataSetGet.OLD_USER = -1;
  27. JOptionPane.showMessageDialog(null, "2"+ex);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement