Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. import java.io.*;
  2. import java.sql.*;
  3. import java.util.*;
  4.  
  5. public class FireBirdConnection {
  6.  
  7. public Connection con = null;
  8. public Statement stmt;
  9. public ResultSet rs;
  10.  
  11. public FireBirdConnection() {
  12. String driver = null;
  13. String url = null;
  14. String login = null;
  15. String pass = null;
  16.  
  17. Parameters params = null;
  18. try {
  19. params = new Parameters();
  20. } catch (FileNotFoundException e) {
  21. e.printStackTrace();
  22. }
  23.  
  24. try {
  25. url = params.getDataBaseHost();
  26. login = params.getDataBaseUser();
  27. pass = params.getDataBasePassword();
  28. driver = params.getDataBaseDriver();
  29. } catch (Exception ex) {
  30. ex.printStackTrace();
  31. }
  32.  
  33. try {
  34. Class.forName(driver).newInstance();
  35. con = DriverManager.getConnection(url, login, pass);
  36.  
  37. } catch (ClassNotFoundException ex) {
  38. System.err.println("FireBirdConnection.Cannot find this DB driver classes.");
  39. ex.printStackTrace();
  40. } catch (SQLException e) {
  41. System.err.println("FireBirdConnection.Cannot connect to this DB.");
  42. e.printStackTrace();
  43. } catch (InstantiationException e) {
  44. e.printStackTrace();
  45. } catch (IllegalAccessException e) {
  46. e.printStackTrace();
  47. }
  48. }
  49. }
  50.  
  51. DBDRIVER=org.firebirdsql.jdbc.FBDriver
  52. ADMINPASSWORD=0095
  53. DBUSER=SYSDBA
  54. DBPASS=masterkey
  55. DBHOST=jdbc:firebirdsql:local:D:\ExamDB\EXAM.FDB?encoding=utf8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement