This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Postgres Connection Pool

 
L'ange Pantoja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, am trying to learn to deploy a Sun Application Server 8. Had completed the installation and testing of the newly installed App Server. However, my projects need to connect to a PostgreSQL database. As I've tried to play around the application console, I found out that Postgres drivers for connection pooling is not available in the bundled application server.

I've tried to look around the net for resources on how to add these resources into the application server, however to no avail.

How do I go about doing this?
 
Raj Saini
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am also looking for the same solution. I will come back to you if I succeed (hopefully I would be)
 
Raj Saini
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You keep the Vendor field for the connection pool empty. it does nothing more then populating the datasource implementation class on next screen.

Other options are:

Resource Type: javax.sql.ConnectionPoolDataSource
DataSource class name: org.postgresql.jdbc3.Jdbc3PoolingDataSource

Provide the other details required on third screen. Theya re specific to your installlation of postgreSQL

Fileds are:
ServerName: <your pgsql server ip or FQDN>
port: port number of pgsql or 0 for defaults
username: user name to connect to server
password: password for above user
database: your initial database to connect to

After finishing you can try pinging from newly created connection pool page.

Raj
 
L'ange Pantoja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Raj...

My problems have been due mainly to one missing step: placing the postgresql driver into the right domain directory.

Here's how: (assuming that we use pg74.213.jdbc3.jar as our driver)
1) copy the driver file into ${SUN_APP_SER_DIR}/domains/${DOMAIN}/lib/ext
2) start/restart the server (i'm not sure if there's a way to force the server to load the classes while running; but in my experience, when the server started without the classes on the directory, it was unable to load the referred classes... the problem disappeared when i restarted the server)
3) then do as Raj suggested
 
peter murray
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following works in SunOne App server 8:

http://doc.postgresintl.com/jdbc/ch11s02.html

Application Servers: ConnectionPoolDataSource

PostgreSQL��� includes one implementation of ConnectionPoolDataSource for JDBC 2 and one for JDBC 3, as shown in Table� 11.1, ���ConnectionPoolDataSource Implementations���.

Table� 11.1.� ConnectionPoolDataSource Implementations
JDBCImplementation Class
2org.postgresql.jdbc2.optional.ConnectionPool
3org.postgresql.jdbc3.Jdbc3ConnectionPool

Both implementations use the same configuration scheme. JDBC requires that a ConnectionPoolDataSource be configured via JavaBean properties, shown in Table� 11.2, ���ConnectionPoolDataSource Configuration Properties���, so there are get and set methods for each of these properties.

Table� 11.2.� ConnectionPoolDataSource Configuration Properties
PropertyTypeDescription
serverNameStringPostgreSQL��� database server host name
databaseNameStringPostgreSQL��� database name
portNumberintTCP port which the PostgreSQL��� database server is listening on (or 0 to use the default port)
userStringUser used to make database connections
passwordStringPassword used to make database connections
defaultAutoCommitbooleanWhether connections should have autocommit enabled or disabled when they are supplied to the caller. The default is false, to disable autocommit.

Many application servers use a properties-style syntax to configure these properties, so it would not be unusual to enter properties as a block of text. If the application server provides a single area to enter all the properties, they might be listed like this:

serverName=localhost
databaseName=test
user=testuser
password=testpassword
 
Joe Sal
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly does "JDBC requires that a ConnectionPoolDataSource be configured via JavaBean properties" mean? I set this up accordingly, but when I try to connect to the datasource in a message listener (which to tell you the truth I'm not entirely positive you can do), i get the following error:

SEVERE: RAR5099 : Wrong class name or classpath for Datasource Object : {0}
java.lang.ClassNotFoundException: org.postgresql.jdbc3.Jdbc3PoolingDataSource
at java.net...

etc.

Any ideas?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic