Question

So Google Cloud SQL has a neat feature where you should be able to connect to your local DB instance for debugging locally as described here:

I've got the following VM arguements:

-Xmx512m -javaagent:C:\eclipse\plugins \com.google.appengine.eclipse.sdkbundle.1.4.2_1.4.2.v201102111811\appengine-java-sdk-1.4.2\lib\agent\appengine-agent.jar 
-Drdbms.server=local 
-Drdbms.driver=com.mysql.jdbc.Driver 
-Drdbms.url=jdbc:mysql://localhost:3306/testdb?user=root&password=pass

I've put the msql driver in the C:\eclipse\plugins \com.google.appengine.eclipse.sdkbundle.1.4.2_1.4.2.v201102111811\appengine-java-sdk-1.4.2\lib\impl folder and added it to the class path.

However when running a simple SELECT query (and this runs fine when deployed on GAE) it tosses the following exception.

java.sql.SQLException: Table not found in statement [SELECT * FROM SOME_TABLE] 

Here's the offending code snippet:

            Connection c = null;
            try {
                    DriverManager.registerDriver(new AppEngineDriver());
                    c = DriverManager.getConnection(MY GOOGLE CLOUD SQL CXN STRING);
                    PreparedStatement ps = c.prepareStatement("SELECT * FROM SOME_TABLE");

                    ResultSet rs = ps.executeQuery(); 
    } catch (SQLException e) {
        e.printStackTrace();
            }

I suspect it's not realizing it has to connect locally, what should I be checking?

Was it helpful?

Solution

Just to mark this as answered: solution provided by Dave W. Smith above

From Dave W. Smiths comment:

I don't know how significant this is to the problem at hand, but 1.4.2 is pretty far out of date.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top