Created
September 18, 2018 10:12
-
-
Save ltearno/a3a9096736cb4497aa0f1a0f5cb84c34 to your computer and use it in GitHub Desktop.
Test JDBC
This file contains hidden or 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
package com.test; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
import java.util.Properties; | |
public class TestJDBC { | |
public static void main(String[] args) { | |
Properties props = new Properties(); | |
props.setProperty("user", System.getenv("DB_USER")); | |
props.setProperty("password", System.getenv("DB_PASSWORD")); | |
try { | |
System.out.println(System.getenv("DB_USER")); | |
System.out.println(System.getenv("DB_PASSWORD")); | |
System.out.println(System.getenv("DB_CONNECTION_URL")); | |
Connection conn = DriverManager.getConnection(System.getenv("DB_CONNECTION_URL"), props); | |
System.out.println(conn); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment