Last active
May 3, 2016 00:23
-
-
Save JFRode/72ac675b9147664906823f2e095163c2 to your computer and use it in GitHub Desktop.
heroku JDBC connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// credit /okedokee | |
private final String JDBC = "postgresql"; | |
private final String HOST = ""; | |
private final String PORT = "5432"; | |
private final String DATABASE = ""; | |
private final String USER = ""; | |
private final String PASSWORD = ""; | |
private final String DRIVER = "org.postgresql.Driver"; | |
private String url; | |
private Connection conexao; | |
public Conexao() { | |
try { | |
url = "jdbc:" + JDBC + "://" + HOST + ":" + PORT + "/" + DATABASE; | |
Properties prop = new Properties(); | |
prop.setProperty("user", USER); | |
prop.setProperty("password", PASSWORD); | |
prop.setProperty("ssl", "true"); | |
prop.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); | |
conexao = DriverManager.getConnection(url, prop); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment