Thursday, October 7, 2010

Configuring Database in Glassfish(GF) Server


Hi All,

I have tried making an application implementing JAAS on GlassFish(GF) server for a Web and EJB.

To configure your database with GF you have to follow these steps as

1. Start your GF server.

2. Go to your admin console http://localhost(or IP):4848/

3. In the left panel you will find Resouces --> JDBC --> Connection Pools

4. Now on the right panel create a new databse connection as

6. Give the name you would like to name your databse connection
Name : myDB
Resource Type : javax.sql.DataSource
Databse Vendor : mysql

7. Now go to JDBC resource there again add new connection
JNDI Name : jdbc/mySql
Pool Name : myDB
Description : This is my DB connection.
Status : Enabled

8. After creating the connection edit its properites as and you may remove all other properties
datasource-jndi : jdbc/mySql
user-table : usertable
user-name-column : userid
password-name-column : password
group-table : grouptable
group-name-column : groupid
jaas-context : jdbcRealm
digest-algorithm : none

Now to use this connection in your existing application configure your GlassFish(GF) server's realm.
Configuring your own realm. You can check in the same


Regards,
Gaurav Agarwal

No comments: