Amy
Amy

Reputation: 31

How to connect to a database on the server side in a GWT project?

I am designing a simple authentication application using GWT. There is no processing done on the client side. On the server side there is a authenticate() function which should connect to a database and return a string "success" or "failure "to the client. I am executing the code in the development mode. I am using a sybase database. I have added the required jar files in war/WEB-INF/lib as well as in the build path. But i am facing issues in connecting to a database. Database driver gets loaded successfully but getConnection() method shows a lot of RPC exceptions when i try running the webapp. Can anyone please help.. ??

Upvotes: 0

Views: 822

Answers (1)

Rade_303
Rade_303

Reputation: 905

You cannot connect from client side, you can only do that in server part of the code. Read thoroughly this: GWT documentation on client-server communication.

The actual work of the authenticate() method should be placed inside com.ericsson.authentication.server.AuthenticationServiceImpl class, and authenticate inside com.ericsson.authentication.client.AuthenticationService class should only refer to server counterpart.

Upvotes: 2

Related Questions