Guest User

Untitled

a guest
Dec 26th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. String jdbcURL = "jdbc:mysql://google/[Censored]?cloudSqlInstance=[Censored]&socketFactory=com.google.cloud.sql.mysql.SocketFactory";
  2. try {
  3. sqlConnection = DriverManager.getConnection(jdbcURL, "[Censored]", "[Censored]");
  4. try (Statement statement = sqlConnection.createStatement()) {
  5. ResultSet resultSet = statement.executeQuery("SHOW TABLES");
  6. while (resultSet.next()) {
  7. System.out.println(resultSet.getString(1));
  8. }
  9. }
  10. } catch (SQLException e) {
  11. e.printStackTrace();
  12. }
  13.  
  14. java.sql.SQLNonTransientConnectionException: Could not create connection to database server.
  15.  
  16. 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