Configuring a JNDI data source in Grails couldn’t be simpler; specifying the JNDI name is the only
requirement.
Example:
production {
dataSource {
jndiName = "java:comp/env/jdbc/app-db"
}
}
Of course, this assumes that the work has been done to configure the deployment environment to
supply the JNDI data source correctly.
Here we are going to configure JNDI resources with Tomcat.
Edit conf/context.xml and add the following content.
<Resource name="jdbc/app-db" auth="Container" type="javax.sql.DataSource" driverClassName="org.postgresql.Driver" url="jdbc:postgresql://127.0.0.1:5432/app-db" username="Your UserName" password="Your Password" />
DONE.
No comments:
Post a Comment