Hi all, i'm Gianluca and i start from a few week to study Google Web
Toolkit.

In this days i'm trying to load a data from a FireBird Database. But i
have  a problem, can't load!!!
Ok, if i create a projet in java , i can normally extract a data from
my database( creating connection  with JDBC).

I also copy the class created in java for connection to the database
in my GWT project, but the error that Eclipse show me in the console
is:

org.firebirdsql.jdbc.FBDriver

I show you my  GWT project:



The main class call ChiamataServe.javar ( italian name , i'm italian):

package mioesempio.client;



import mioesempio.shared.FieldVerifier;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;


public class ChiamataServer implements EntryPoint {

        public FlexTable tabella= new FlexTable();
        public VerticalPanel pannello=new VerticalPanel();

        public void onModuleLoad(){


                tabella.setText(0, 0, "Id");
                tabella.setText(0, 1, "Nome ");
                tabella.setText(0, 2, "Cognome ");


                pannello.add(tabella);




                ServizioRemotoAsync sra;
                sra=(ServizioRemotoAsync) GWT.create(ServizioRemoto.class);

                ServiceDefTarget target= (ServiceDefTarget) sra;
                target.setServiceEntryPoint(GWT.getModuleBaseURL() + "data");

                AsyncCallback callbackTabella =new AsyncCallback(){

                        public void onSuccess(Object oggetto){
                                Utente[] utente= (Utente[]) oggetto;
                                Window.alert("Server risponde");

                                for(int i=0; i<utente.length; i++){
                                        Window.alert("Nome utente: 
"+utente[i].getNome());
                                        Window.alert("Cognome utente : 
"+utente[i].getCognome());

                                }
                        }

                        public void onFailure(Throwable caught){
                                Window.alert("Connesisone Non Riuscita");
                        }
                };

                sra.getTabella(callbackTabella);

                RootPanel.get("slot").add(pannello);
        }
}


I created the interface ServizioRemoto.java for implements a RPC:

package mioesempio.client;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("data")
public interface ServizioRemoto extends RemoteService{



        Utente[] getTabella();




}


and the class ServizioRemotoAsync :

package mioesempio.client;
import com.google.gwt.user.client.rpc.AsyncCallback;

public interface ServizioRemotoAsync {



        void getTabella(AsyncCallback<Utente[]> callback);

}


After i created an implementation on the server ServizioRemotoImpl:

package mioesempio.server;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

import mioesempio.client.ListaUtenti;
import mioesempio.client.ServizioRemoto;
import mioesempio.client.Utente;

import com.google.gwt.user.client.Window;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class ServizioRemotoImpl extends RemoteServiceServlet
implements ServizioRemoto{


                public Utente[] getTabella(){

                Utente[] lista = null;

                String databaseurl= 
"jdbc:firebirdsql:127.0.0.1/3050:E:/TIROCINIO/
Database/basedati.fdb";
                String username = "sysdba";
                String password = "masterkey";

                String driverName= "org.firebirdsql.jdbc.FBDriver";

                Connection connessione;
                Statement stm;
                ResultSet risultatoUtenti;



                try {
                        Class.forName(driverName).newInstance();

                        connessione = DriverManager.getConnection(databaseurl, 
username,
password);

                        stm= connessione.createStatement();

                        String sql= "SELECT * FROM utenti";

                        risultatoUtenti=stm.executeQuery(sql);

                        int i=0;

                        risultatoUtenti.last();
                        int size = risultatoUtenti.getRow();
                        risultatoUtenti.beforeFirst();

                        while(risultatoUtenti.next()){

                                lista = new Utente[size];

                                lista[i].nome=risultatoUtenti.getString("nome");
                                
lista[i].cognome=risultatoUtenti.getString("cognome");


                                i++;

                        }
                        risultatoUtenti.close();
                        connessione.close();
                }
                catch(Exception e){
                        System.out.println(e.getMessage());
                }

                return lista;
        }


}


That' all, when i run this Project, there is a message that the RPC is
successful with the onSuccess message.
But i cant see my data stored on the database, console show me the
name of driver!!!

org.firebirdsql.jdbc.FBDriver


Can someone help me?

Thanks all , and sorry for my english


Gianluca

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to