Accessing a local MySQL instance in your GAE development environment for java using eclipse -
i new google app engine environment. starting project using google cloud sql. testing purpose need setup local mysql instance. have tried searching answer, didn't find helped me.
if summarize question, trying access local mysql instance in gae development environment using java in eclipse.
you have add mysql connector in app engine sdk folder.
you can find connector there: http://dev.mysql.com/downloads/connector/j/. then, have place in folder: appengine-java-sdk\lib\impl
then have run local version of mysql (for example using easyphp).
here sample of code use connect database (singleton) :
public static connection getinstance() throws exception { if (connection != null && !connection.isclosed()) { return connection; } if (islocaltesting) { //mysql string url = "jdbc:mysql://127.0.0.1:3306/your_db_name"; connection = drivermanager.getconnection(url, "root", ""); } else { // google cloud sql drivermanager.registerdriver(new appenginedriver()); connection = drivermanager.getconnection("jdbc:google:rdbms://" + instancename + "/name_db"); } return connection; }
and lastly: have include mysql library in build path well: http://prntscr.com/124jwm