google app engine - Connecting GWT and PostgreSQL -
i've been working gwt , appengine. want change database relational one. prefer postgresql on mysql because of schema architecture.
i work in projects jdbc, cannot make work in appengine project.
what doing wrong?
i think mistake. if want backend connect jdbc have disable appengine.
i recommend creating new web project google eclipse plugin without appengine. copy source files , start there.
i let class connect postgresql vua jdbc
public class conexionbd { private vector <connection> connections = new vector<connection>(); protected int cantcon=3; private static conexionbd pool; private conexionbd(){ (int i= 0; i< cantcon;i++) connections.add(connect()); } public static conexionbd getpoolconnection(){ if (pool== null) pool =new conexionbd(); return pool; } private connection connect() { try { //setear driver class.forname ("org.postgresql.driver").newinstance (); connection con = drivermanager.getconnection ("jdbc:postgresql://localhost:5432/llevomisnegocios","postgres","root"); return con; } catch (sqlexception e){ system.out.println("mensaje error al conectar: " + e.getmessage()); //system.out.println("stack trace: " + e.getstacktrace()); return null; }catch (exception ex){ system.out.println("mensaje error al conectar: " + ex.getmessage()); //system.out.println("stack trace: " + ex.getstacktrace()); return null; } } public void closeconnections(){ (int i=0; i<connections.size();i++) { try { connections.elementat(i).close(); } catch(exception e) { system.out.println("mensaje error: " + e.getmessage()); system.out.println("stack trace: " + e.getstacktrace()); } } } public connection getconnection(){ connection c = null; if (connections.size()>0) c = connections.remove(0); else{ c = connect(); system.out.println("poolconnection: conexion exitosa con la bd"); } return c; } public void realeaseconnection(connection c){ connections.add(c); } }
Comments
Post a Comment