Re: [BUGS] BUG #1026: org.apache.commons.dbcp.DbcpException: - Mailing list pgsql-jdbc

From Tammy Jones
Subject Re: [BUGS] BUG #1026: org.apache.commons.dbcp.DbcpException:
Date
Msg-id 3FE9C5DF.2040501@larc.nasa.gov
Whole thread Raw
In response to Re: [BUGS] BUG #1026: org.apache.commons.dbcp.DbcpException:  (Dave Cramer <pg@fastcrypt.com>)
Responses Re: [BUGS] BUG #1026: org.apache.commons.dbcp.DbcpException:  (Dave Cramer <pg@fastcrypt.com>)
List pgsql-jdbc
I am building dspace from source, however ant test does not work.  I get the following error:
$ ant test
Buildfile: build.xml

BUILD FAILED
Target `test' does not exist in this project.


I tried running the psql commands just like below and still only get SELECT as the response.

Below is a snippit of our installation process that involved postgres.  Maybe it'll help shed some light.

Notation

Throughout the course of this document we will used the following notation:

[postgres-src] – This is the source from which you will build and install the PostgreSQL database system.  We used /usr/local/postgresql-7.3.4.

[postgres] – The directory in which you will/have install(ed) PostgreSQL.  We used /usr/local/pgsql.

[postgres-data] – This is the location of the PostgreSQL database, which will then contain the data from DSpace.  We used /usr/local/pgsql/data.  Note: that this directory must have rwx permissions for the PostgreSQL user.

PostgreSQL

We used 7.3.4.

Pre-requisite Software:

gmake or make:  Download the GNU Make binary file, which comes as a .tar.gz compressed file.  We located GNU Make at /usr/local/bin/make.

gcc:  Download the gcc binary file, which comes as a .tar.gz compressed file.  We located gcc at /usr/local/bin/gcc.

readline:  Download the readline binary file, which comes as a .tar.gz compressed file.  We located readline at /usr/local/bin/readline.

Copy the libreadline library into /usr/lib and /usr/local/lib.

JDBC:  Download the JDBC drivers at http://jdbc.postgresql.org/download.html.  We located the download at /usr/local/jdbc.

Installation:

Note:  DSpace comes packaged with a postgresql.jar file for an older version of PostgreSQL.  To make DSpace work with PostgreSQL 7.2.4 it is necessary to replace their version of postgresql.jar with the new one created with this installation.

Note: You require Ant 1.5 in order to build PostgreSQL 7.2.4 using the –-with-java option required to create the drivers for DSpace.

Note:  You must do the installation in bourne shell.

·         Create a user called postgres and a group of the same name.

·         Login as postgres in order to do the installation.

·         Configure the source:

Go to the directory [postgres-src], and run the following command:

./configure --prefix=[postgres]

–-enable-multibyte

--enable-unicode

--with-java

·         make PostgreSQL:

In [postgres-src] run the command:

make

·         Install PostgreSQL:

In [postgres-src] run the command:

make install

·         Create the database:

Use the following commands (you may be in any system directory provided that you use the full path names of each directory):

mkdir [postgres-data]

[postgres]/bin/initdb –D [postgres-data]

·         Copy the postgresql.jar file

cp [postgres]/share/java [DSpace-src]/lib

·         Place the libgcc library in the postgres library

cp libgcc_s.so.1 [postgres]/lib/.

·         Copy the JDBC driver jar file to postgres:

cp jdbcDriver.jar [postgres]/share/java/.

·         Edit the postgres configuration file, [postgres]/data/postgresql.conf.  to switch on the TCP/IP connections and configure the port:

Set the following configuration parameters:

tcpip_socket=true

port=5432

·         Set the following environment variables:

PGDATA=[pgsql]/data

PGPORT=5432

·         Start the database service:

[postgres]/bin/postmaster –o "-i" -D /usr/local/pgsql/data > logfile  2>&1 &

DSpace Installation

·         Create a DSpace user and a group of the same name, containing that user.

·         Log in as DSpace.

·         Create the DSpace database and user for that database:

Use the following commands in the directory [postgres]/bin:

createuser –U postgres –d –A –P DSpace

createdb –U DSpace DSpace –E UNICODE


Dave Cramer wrote:

Tammy,

are you building the jar from source? if so can you try running ant test
?
also see my comments below

Dave

On Wed, 2003-12-24 at 09:32, Tammy Jones wrote: 
Kris Jurka wrote:   
PostgreSQL version: 7.3.4

Description:        org.apache.commons.dbcp.DbcpException: The connection
attempt failed because failed getting backend

We are trying to install DSPACE with POSTGRES.  When we run the ant
fresh_install command we get the following error.  What could be causing a
org.apache.commons.dbcp.DbcpException: The connection attempt failed because
failed getting backend encoding?          
Have you been able to establish a JDBC connection at all or is this error
only with dspace?     
I really haven't tried postgres with anything other than dspace.   
Could you enable logging on the server and see if that comes up with
anything interesting?  (Enable log_statement in postgresql.conf and
restart the server making sure the output is going somewhere other than
/dev/null)     
I enabled logging.  The logging results are below with the query
results.   
What do you get from the results of the following queries when run in
psql?      
I assume that I am running the queries appropriately.  The database
service had to be started because of copy paste problems, not because
of the queries below.   Here are the results:   
SELECT version();     
$psql -d dspace -c "SELECT version();"   
you really should be getting something like~/reiser/informix7.4/bin/psql isp -c "select version()"                                                    version
------------------------------------------------------------------------------------------------------------------PostgreSQL 7.4informix1.4 on i686-pc-linux-gnu, compiled by GCC gcc
(GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
(1 row)

and 
~/reiser/informix7.4/bin/psql -d isp -c "select pg_encoding_to_char(1)"pg_encoding_to_char
---------------------EUC_JP
(1 row)


not SELECT ??


 
SELECT
$ more logfile
2003-12-24 09:21:12 LOG:  database system was shut down at 2003-12-24
09:20:46 E
ST
2003-12-24 09:21:12 LOG:  checkpoint record is at 0/84FAA8
2003-12-24 09:21:12 LOG:  redo record is at 0/84FAA8; undo record is
at 0/0; shu
tdown TRUE
2003-12-24 09:21:12 LOG:  next transaction id: 587; next oid: 25169
2003-12-24 09:21:12 LOG:  database system is ready
2003-12-24 09:21:44 LOG:  query: begin; select getdatabaseencoding();
commit
2003-12-24 09:21:44 LOG:  query: SELECT version();
RESULT :c=0.00..0.01 :r=1 :w=0 
RESULT :c=0.00..0.01 :r=1 :w=0 
2003-12-24 09:22:49 LOG:  query: begin; select getdatabaseencoding();
commit
2003-12-24 09:22:49 LOG:  query: SELECT version();
RESULT :c=0.00..0.01 :r=1 :w=0 
RESULT :c=0.00..0.01 :r=1 :w=0    
SELECT pg_encoding_to_char(1);     
$ psql -d dspace -c "SELECT pg_encoding_to_char(1);"
SELECT
$ more logfile
2003-12-24 09:25:28 LOG:  database system was shut down at 2003-12-24
09:25:01 E
ST
2003-12-24 09:25:28 LOG:  checkpoint record is at 0/84FAE8
2003-12-24 09:25:28 LOG:  redo record is at 0/84FAE8; undo record is
at 0/0; shu
tdown TRUE
2003-12-24 09:25:28 LOG:  next transaction id: 593; next oid: 25169
2003-12-24 09:25:28 LOG:  database system is ready
2003-12-24 09:25:33 LOG:  query: begin; select getdatabaseencoding();
commit
2003-12-24 09:25:33 LOG:  query: SELECT pg_encoding_to_char(1);
RESULT :c=0.00..0.01 :r=1 :w=0 
RESULT :c=0.00..0.01 :r=1 :w=0    
SELECT getdatabaseencoding();     
$ psql -d dspace -c "SELECT getdatabaseencoding();"
SELECT
$ more logfile
2003-12-24 09:26:46 LOG:  database system was shut down at 2003-12-24
09:26:26 E
ST
2003-12-24 09:26:46 LOG:  checkpoint record is at 0/84FB28
2003-12-24 09:26:46 LOG:  redo record is at 0/84FB28; undo record is
at 0/0; shu
tdown TRUE
2003-12-24 09:26:46 LOG:  next transaction id: 596; next oid: 25169
2003-12-24 09:26:46 LOG:  database system is ready
2003-12-24 09:26:55 LOG:  query: begin; select getdatabaseencoding();
commit
2003-12-24 09:26:55 LOG:  query: SELECT getdatabaseencoding();
RESULT :c=0.00..0.01 :r=1 :w=0 
RESULT :c=0.00..0.01 :r=1 :w=0    
Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
      
-- 
Tammy Jones

ANALYTICAL SERVICES & MATERIALS
NASA LaRC
2 West Durand Street
Hampton, VA  23681

Mail Stop 185
Building 1194, Room 106                              
Phone:  4-8003
Fax:    4-8869

_____________________________________________________ 
"When your values are clear your decisions are easy"   -Walt Disney-
_____________________________________________________ 
   
 

-- 
Tammy Jones

ANALYTICAL SERVICES & MATERIALS
NASA LaRC
2 West Durand Street
Hampton, VA  23681

Mail Stop 185
Building 1194, Room 106                              
Phone:  4-8003
Fax:    4-8869

_____________________________________________________ 
"When your values are clear your decisions are easy"   -Walt Disney-
_____________________________________________________ 

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: [BUGS] BUG #1026: org.apache.commons.dbcp.DbcpException:
Next
From: Dave Cramer
Date:
Subject: Re: [BUGS] BUG #1026: org.apache.commons.dbcp.DbcpException: