connecting to PostgreSQL with vaadin

Hi,

I’ve just started with Vaadin and done the vaadin tutorial . I want to create one Login page and i want to verify that whether the user is authenticated or not based on the database which i have created in PostgreSQL. Problem is I have no clue on how to connect to a PostgreSQL database with Vaadin.

There isn’t really much Vaadin specific about connecting to a database. Usually you would keep transactions within each request from the user interface (e.g. with a Vaadin TransactionListener or HttpServletRequestListener - search for these in database context).

A few words about these in
this forum post
,
this one
and many others. There are also examples and more complete application frameworks around, like
AppFoundation
.

Search for tutorials on JDBC (lower level database access API), JPA (higher level object relational mappings) and EclipseLink or Hibernate (JPA implementations) on the web.

As Henri pointed out, there’s nothing specific to Vaadin about DB access. You can access your database however you would in any Java server application.

However, I’d like to ask why you’re querying the database yourself and how you’re collecting the credentials? Having worked in the app server security area, I believe it’s a lot easier to let the container manage the authentication for you. It takes a lot of the work out of your hands.

Can you tell me:

  1. How do you want to collect the credentials? For instance, in a separate html page before they access your application (form-based authentication) or from some Vaadin form inside your app?

  2. Have you considered letting the container handle the security for you? In that case, you define a JDBC realm inside your application server and you give it the table/column information. Then you can specify that realm in the deployment descriptors for your app, giving you a nice separation between the application and the user storage?

There’s also the AppFoundation as Henri points out. If using Tomcat rather than a full EE application server, that sounds like a good way to go.

Cheers,
Bobby

Hi

You can refer previous forum post… Similar queries posted. check it once. it may help you.

Simply you need postgre sql jar file into jdk jre lib ext path or your class path… you can found jar file :: http://jdbc.postgresql.org/download.html… and you can use your normal java jdbc code in vaadin for connecting postgresql to vaadin application.

Regards
R Prabu