Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static Connection getConnection() {
- final Logger resultLog = Logger.getLogger(DataClassInsert.class);
- String driver = Tools.propertieReader("driver");
- String url = Tools.propertieReader("url");
- String username = Tools.propertieReader("username");
- String password = Tools.propertieReader("password");
- Connection conn = null;
- try {
- Class.forName(driver);
- conn = DriverManager.getConnection(url, username, password);
- } catch (SQLException e) {
- e.printStackTrace();
- String SQLmessage = e.getMessage();
- String SQLstate = e.getSQLState();
- int vendorcode = e.getErrorCode();
- resultLog.error("An excetion hasse occured");
- resultLog.error("Message : " + SQLmessage);
- resultLog.error("Sate : " + SQLstate);
- resultLog.error("VendorCode : " + vendorcode);
- System.exit(0);
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- resultLog.error("Exception ; " + e.getMessage());
- }
- return conn;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement