Startups : Rajesh Ramchandani's Weblog
PostgreSQL with Sun Java System Application Server 8.1
Recently we tested out Open source databases (Postgresql and MySQL) for their JDBC Compliance and their capabilities to work with J2EE compliant Application servers such as Sun Java System Application server 8.1. Dave Cramer, the lead JDBC developer for PostgreSQL and Lance Obermeyer of Pervasive Software Inc. offered their engineering support and implemented the missing functions, data conversion routines and also fixed several bugs to be able to pass the JDBC compliance and also other tests (CMP/EJB tests) that any backend must pass in order to be Compliant to work with J2EE certified Application servers. All the changes and fixes that were done in the driver aren't part of the community release yet, but will be soon in near future. Also, we needed support for Stored procedures, so we had to use Postgresql 8.1-dev development release.
1. Under Resources, select JDBC and on right hand side frame, select Connection Pools
2. Click on New to add create a new connection pool
3. Provide some name such as postgresql-pool and select Datasource type as javax.sql.ConnectionPoolDataSource
4. Click Next and enter the Datasource Classname as org.postgresql.ds.PGSimpleDataSource
5. Add the following properties to the connection pool:
DatabaseName <your-db-name>
port <your-selected-port-number> default port is 5432
user <DB-User-Name>
Password <DB-User-Password>
ServerName <DB-Server-Name>
Save the settings and click on Ping. If DB server is running and connection can be made, Ping will succeed. Please make sure you have copied the Postgresql jdbc driver in $J2EE_HOME/domains/<domain-name>/lib/ext directory.
Here's an sample domain.xml from an working installation:
<jdbc-connection-pool connection-validation-method="auto-commit"
datasource-lassname="org.postgresql.ds.PGSimpleDataSource"
fail-all-connections="false" idle-timeout-in-seconds="300"
is-connection-validation-required="false"
is-isolation-level-guaranteed="false" max-pool-size="96"
max-wait-time-in-millis="60000" name="cts-postgresql-pool"
pool-resize-quantity="2" res-type="javax.sql.DataSource "
steady-pool-size="32"> Restart the domains using "asadmin stop-domain and Jonathan Bruce's blog for using MySQL with Sun Java System Application Server at:
If you use Postgresql or are planning to use in near future and have questions about PostgreSQl on Solaris platform or questions, issues with Sun Java System application server with PostgreSQL (or MySQL), please feel free to contact me.
Posted at 07:24PM Jun 27, 2005
by rrajesh in Open Source |
Comments[17]
In order to make PostgreSQL work with Sun Java System Application server 8.1, you need to create a .tpersistence.properties file under $J2EE_HOME/domains/
database.postgresql.QUOTE_CHAR_END=
database.postgresql.QUOTE_CHAR_START=
database.postgresql.RTRIM=
database.postgresql.RTRIM_POST=
database.postgresql.SQRT=SQRT
database.postgresql.ABS=ABS
Creating Connection Pool
To create Connection Pools for Postgresql, under Admin server console:
<property
name="DatabaseName"
value="ctsinout"/>
<property name="port"
value="5432"/>
<property name="user"
value="postgres"/>
<property
name="ServerName" value="magnolia"/>
<property name="password"
value="postgres"/>
<property
name="prepareThreshold"
value="3"/>
Use Server Side Stored
procedures
<property name="loglevel"
value="2"/>
DEBUG Level log
<property
name="protocolVersion" value="2"/>
<property name="ssl"
value="true"/>
</jdbc-connection-pool>
You can read Lance Andersen's blogs for using Derby with Sun java System Application server at:
Derby with Sun Java Application Server
MySQL with Sun Java Application Server
Posted by Abhinav Rawal on September 30, 2005 at 04:27 AM PDT #
Posted by Rajesh Ramchandani on September 30, 2005 at 10:32 AM PDT #
Posted by Ahmed Kamal on October 04, 2005 at 01:41 AM PDT #
Posted by Rajesh Ramchandani on October 04, 2005 at 10:13 AM PDT #
4. Click Next and enter the Datasource Classname as org.posgtresql.ds.PGSimpleDataSource
I had copied and pasted this from this page without checking and finding the typo. Its a simple mistake Rajesh and I thank you for being such a big help by looking thru my files to find the problem but now that I have identified it I hope you can fix the typo asap.
Thank you once again!
Posted by Ahmed Kamal on October 05, 2005 at 03:30 AM PDT #
Posted by Rajesh Ramchandani on October 05, 2005 at 09:08 AM PDT #
I don't intend to sound rude, but:
org.posgtresql.ds.PGSimpleDataSource
is a typo. There is no 'posgtresql' library. Its 'postgresql'. Even in your recent reply you specified:
java.xsql.ConnectionPooldataSource
when in fact the correct spelling is:
javax.sql.ConnectionPoolDataSource
Previously I was having a problem of the server not even being able to find the class file, it has nothing to do with what type of datasource I set in the Sun server settings. Everything has been resolved now that I have changed the spelling, and like I said previously- please fix this typo so that others don't make the same mistake I did.
Also what do you mean by this: $J2EE_HOME/domains//config ? Do you mean $J2EE_HOME/domains/domain1/config??
Posted by Ahmed Kamal on October 05, 2005 at 07:03 PM PDT #
Posted by Rajesh Ramchandani on October 09, 2005 at 12:47 PM PDT #
Posted by 212.151.198.78 on November 15, 2005 at 10:11 AM PST #
Posted by Akos Gabriel on June 09, 2006 at 01:14 PM PDT #
Posted by arnaud on September 13, 2006 at 09:31 AM PDT #
Posted by arnaud on September 14, 2006 at 09:36 AM PDT #
Posted by henry on December 15, 2006 at 11:33 PM PST #
Posted by raj on February 24, 2007 at 03:26 AM PST #
Posted by Rajesh on February 25, 2007 at 09:35 PM PST #
hi there,
sorry if i sound too plan in my letter. is just that i can seem to find the datasource classname for sql server. please help me out .
Posted by Innocent on November 16, 2007 at 08:19 AM PST #
i fouund problem in pinging that the classpath is not set or classname is not found.I have checked the above given solutions but still i am facing this problem.If I want to send you my .xml file and the error screenshots on which link i can send?
Posted by ramsha on October 20, 2008 at 03:24 AM PDT #