Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nuxlli
Created November 2, 2020 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nuxlli/8797068d74afe99e84effd1ecce00e55 to your computer and use it in GitHub Desktop.
Save nuxlli/8797068d74afe99e84effd1ecce00e55 to your computer and use it in GitHub Desktop.
import java.sql.SQLException;
import java.sql.DriverManager;
import java.sql.Connection;
public class TestConnect {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
System.out.println("Connection test...");
//you need create database with this name 'github-example-jdbc'
String url = System.getenv("RUNDECK_DATABASE_URL");
String user = System.getenv("RUNDECK_DATABASE_USERNAME");
String password = System.getenv("BRUNDECK_DATABASE_PASSWORD");
Class.forName(System.getenv("RUNDECK_DATABASE_DRIVER"));
Connection connection = DriverManager.getConnection(url, user, password);
System.out.println("Connected...");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment