Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package Database;
  2. import java.sql.*;
  3. import com.mchange.v2.c3p0.*;
  4. import java.beans.PropertyVetoException;
  5. public class C3poDataSource {
  6.  
  7. private static ComboPooledDataSource cpds = new ComboPooledDataSource();
  8.  
  9. static {
  10. try {
  11. cpds.setDriverClass("oracle.jdbc.driver.OracleDriver");
  12. cpds.setJdbcUrl("jdbc:oracle:thin:@localhost:1521:xe");
  13. cpds.setUser("dziennik3");
  14. cpds.setPassword("natan1995");
  15. } catch (PropertyVetoException e) {
  16. System.out.println("Error" + e.getMessage());
  17. }
  18. }
  19. public static Connection getConnection() throws SQLException {
  20. return cpds.getConnection();
  21. }
  22. private C3poDataSource(){}
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement