PDA

View Full Version : GXT + MySQL



NorthernDemon
2 Mar 2010, 9:49 AM
How to work with MySQL on GXT (java) ?

I have tried:
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
But it says that imports does not supports by GWT.

http://code.google.com/p/gwt-example...ject_MySQLConn
does not work eather.

private Connection getConn() {

Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "wevote";
String driver = "com.mysql.jdbc.Driver";
String user = "root";
String pass = "";

try {
Class.forName(driver).newInstance();
} catch (Exception e) {
e.printStackTrace();
}

try {
conn = DriverManager.getConnection(url+db, user, pass);
} catch (Exception e) {
System.err.println("Mysql Connection Error: ");
e.printStackTrace();
}

return conn;
}

micgala
3 Mar 2010, 12:25 AM
Hi.

Not the entire java jre is supported by gwt.
I strongly recommend you reading the gwt developer's guide, as this is more a gwt topic then a gxt one.

http://code.google.com/webtoolkit/doc/latest/DevGuide.html

Regards,
Michel.

NorthernDemon
3 Mar 2010, 12:27 AM
Thx) I have found a solution.

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=GettingStartedRPC