Search code examples
sql-server-2008gwtjakarta-eejdbcgwt-rpc

Google Web Toolkit, RPC ans MSSQL


I implemented google's "Build a sample GWT Application" and "GWT RPC" projects from http://code.google.com/webtoolkit/doc/latest/tutorial/ its site. I need one more thing; a database connection with my project.

I have to use MSSQL SERVER 2008 for the project, and I downloaded JDBC driver's jar files for MSSQL, referenced them from Java Build Path menu, and put them in the project's war/WEB-INF/lib folder. I don't know how to go on. I also have DB Connection class. I put that class into the server side. It uses 'java.sql' package.

can you help me please.


Solution

  • On the server side in GWT you can work with Connection as in any other project is not based on the GWT. For example

    PreparedStatement ps = null;
    ResultSet resultSet = null;
    ps = connection.prepareStatement("Select * from Users Us");
    resultSet = ps.executeQuery();
    while (resultSet.next()) {
        //take the field and do something with it. You can take something with construction "resultSet.getInt("Us.id")"
    }
    

    You can also use for to get data ORM, such as Hibernate.