Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String jdbcURL = "jdbc:mysql://google/[Censored]?cloudSqlInstance=[Censored]&socketFactory=com.google.cloud.sql.mysql.SocketFactory";
- try {
- sqlConnection = DriverManager.getConnection(jdbcURL, "[Censored]", "[Censored]");
- try (Statement statement = sqlConnection.createStatement()) {
- ResultSet resultSet = statement.executeQuery("SHOW TABLES");
- while (resultSet.next()) {
- System.out.println(resultSet.getString(1));
- }
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
- java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
- Caused by: java.lang.RuntimeException: The Google Cloud SQL API is not enabled for project [Censored]. Please use the Google Developers Console to enable it:...
Add Comment
Please, Sign In to add comment