I am new to Eclipse.
Currently developing a sample web application using primefaces 3.1 and glassfish 3.
I have created a oracle database connection under datasource explorer. I would like to know how to
integrate this with my web application, so that I could connect to database from my web application. I know that by creating context.xml and entering the following might be suffice for database access, but are there anyways to integrate database connection with my application? So that I do not need to hard code password in context.xml.
I have used Jdeveloper in the past and by creating a database connection corresponding datasource entries in xml are generated. So I was wondering something similar would be possible using Eclipse?
Any help is highly appreciated.
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/SampleDB" auth="Container"
type="javax.sql.DataSource"
username="app" password="app"
driverClassName="org.apache.derby.jdbc.ClientDriver"
url="jdbc:derby://localhost:1527/sample"
maxActive="8" />
</Context>
I have found a solution to create datasource for glassfish.
I created a a JDBC Resource under GlassFish and pointed connection to my connection created under Date Source Explorer. It created a
sun-resources.xml. I had to manually rename this toglassfish-resource.xml. By default there are no entry for password,so I had to manually add . When I ran my web application I was getting this errorSo to resolve this error I added a property in JDBC Connection Pool in glassfish admin server. Now I could connect to Oracle database.
Not sure why I have to do two steps manually. Besides by default it creates
sun-resources.xml. Perhaps someone could point out how to workaround these.Thanks