Skip to content

Instantly share code, notes, and snippets.

@zaleslaw
Last active November 11, 2016 17:32
Show Gist options
  • Save zaleslaw/216b7f2317a0f3a49aed3cf5b5ca0a87 to your computer and use it in GitHub Desktop.
Save zaleslaw/216b7f2317a0f3a49aed3cf5b5ca0a87 to your computer and use it in GitHub Desktop.
JDBC intro
public static void main(String[] args) throws SQLException {
Connection connection = getConnection(DB_NAME);
System.out.println(connection.getCatalog());
}
private static Connection getConnection(String databaseName) throws SQLException {
return DriverManager.getConnection(URL + databaseName, USER_NAME, PASSWORD);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment