Hi mate
Just create your app with eclipse 3.4.
RPC will be already there with all the elements required..
Then you just have to change the app and adjust it to your needs.
Two interfaces are already there: Greetingservice.java and
GreetingServiceAsync.java.
GreetingServiceImpl.java is the server side code.
Yourappname.java is on the client side.
You need to add the database driver to your classpath >> BuildPath.
Also you need to copy the driver to your war/WEB-INF/lib
You need to turn off the GoogleAppEngine (right click your project >>
properties >> AppEngine ) -otherwise the application is complaining
that no suitable driver was found.
After you make your connection to the database and get the results -
you need to put it into an array converting everything to String, Change
the code in the interfaces so they work with an aray ...
example:
package com.gabae.client;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.maps.client.geom.LatLng;
/**
* The client side stub for the RPC service.
*/
@RemoteServiceRelativePath("greet")
public interface GreetingService extends RemoteService {
String[][] greetServer(String[] input); //you send one dimensional
array of strings from the client to the server and recieve
multidin=mensionale Strin[][] array from the server.
}
The GreetingServiceImpl.java must then return String[][] not just String...
Return the array in the GreetingServiceImpl.java and Change
YourAppname.java so its also working with the array Strin[][] rather
that with a String.
Follow this
http://www-lehre.inf.uos.de/~btenberg/misc/DB-Access-in-GWT-The-Missing-Tutorial.pdf
<http://www-lehre.inf.uos.de/%7Ebtenberg/misc/DB-Access-in-GWT-The-Missing-Tutorial.pdf>
But remember that the guy did several mistakes so yu need to think while
doing that.
Reagrds
Peter
Rahul wrote:
> Hi Peter
> Thanks for the reply
> I presently have the driver I need to connect for sqlserver.
> Reading the tutorials one needs to connect with sqlserver via RPC, for
> database connectivity I need to follow all the basic steps in there?
> Sorry to ask this because I am getting confused by this
>
> 1. Create a service on the server.
> 2. Invoke the service from the client.
> 3. Serialize the data objects.
> 4. Handle exceptions: checked and unexpected.
>
> I need to follow all these steps to connect, right?
> Thanks a lot for reply
>
> On Jul 6, 2:17 pm, Piotr Kirklewski<[email protected]>
> wrote:
>
>> Hi mate
>>
>> When you build your GWT application with Eclipse 3.4 its using RPC
>> I'm connecting to my postgres database so you need to research on the
>> driver youneed for SQL server
>> .
>> So:
>> import java.sql.Connection;
>> import java.sql.ResultSet;
>> import java.sql.DriverManager;
>> import java.sql.Statement;
>> import java.sql.SQLException;
>>
>> c =
>> DriverManager.getConnection("jdbc:postgresql://192.168.55.101/databasename",
>> "username", "pass");
>> Statement select =
>> c.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.TYPE_SCROLL_SENSITIVE);
>> ResultSet res = select.executeQuery("select * from fred;");
>>
>> Next stick the results int an array and grab them on the client side
>> from "reusult" :
>>
>> markers[x][0] = new String(result[x][0]);
>> markers[x][1] = new String(result[x][1]);
>> markers[x][2] = new Float(result[x][2]);
>> markers[x][3] = new Float(result[x][3]);
>>
>> I can;t help much with the tree view though.
>>
>> Regards
>>
>> Peter
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---