Users - Using PostgreSQL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Users - Using PostgreSQL

Вадим K.
Hello all,
 
   I am trying to use Postgre instead of default derby DB. I followed the instructions from Undersun, but have little problem connecting to the database. OFBiz can not connect to it.
 
My configuration is: Postgre SQL 7.4.8.
JDBC client database file: in /ofbiz/framework/entity/lib/jdbc called pg74.216.jdbc3.jar
entityengine.xml has being modified to:
 
 <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
        <group-map group-name=" org.ofbiz" datasource-name="localpostgres"/>
        <group-map group-name="org.ofbiz.odbc" datasource-name="localpostgres"/>
    </delegator>

Section with localpostgres left unchanged because I have user:ofbiz with password:ofbiz and database name is also ofbiz
That is all.
 
Error I have: Exception: org.ofbiz.entity.GenericDataSourceException
Message: Unable to esablish a connection with the database. Connection was null!
 
First question - how does entity knows which client .jar file to load?
Why connection does not work?
 
Best regards,

--
/ ** Вадим К. **/

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Using PostgreSQL

Carl Gleisner
Hello,

I'm sorry I can't make out your name but I've been battling the same issue.
Please let me know if you find any solution to it.

Carl

PS How do you write your name with western characters?

Вадим K. wrote
Hello all,

   I am trying to use Postgre instead of default derby DB. I followed the
instructions from Undersun, but have little problem connecting to the
database. OFBiz can not connect to it.

*My configuration is:* Postgre SQL 7.4.8.
*JDBC client database file:* in /ofbiz/framework/entity/lib/jdbc called
pg74.216.jdbc3.jar
*entityengine.xml has being modified to:*

 <delegator name="default" entity-model-reader="main"
entity-group-reader="main" entity-eca-reader="main"
distributed-cache-clear-enabled="false">
        <group-map group-name="org.ofbiz" datasource-name="localpostgres"/>
        <group-map group-name="org.ofbiz.odbc"
datasource-name="localpostgres"/>
    </delegator>

Section with localpostgres left unchanged because I have *user:*ofbiz with *
password:*ofbiz and *database name* is also ofbiz
That is all.

*Error I have:** Exception: org.ofbiz.entity.GenericDataSourceException
Message: Unable to esablish a connection with the database. Connection was
null!*

First question - how does entity knows which client .jar file to load?
Why connection does not work?

Best regards,

--
/ ** Вадим К. **/

 
_______________________________________________
Users mailing list
Users@lists.ofbiz.org
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - Using PostgreSQL

cjhowe
I'm not sure if this issue applies with Postgresql,
but with MySql you need to create the empty database
with the name designated in your datasource (in the
default setting, it is ofbiz) before you're able to
load the tables.  

--- carlj <[hidden email]> wrote:

>
> Hello,
>
> I'm sorry I can't make out your name but I've been
> battling the same issue.
> Please let me know if you find any solution to it.
>
> Carl
>
> PS How do you write your name with western
> characters?
>
>
> Вадим K. wrote:
> >
> > Hello all,
> >
> >    I am trying to use Postgre instead of default
> derby DB. I followed the
> > instructions from Undersun, but have little
> problem connecting to the
> > database. OFBiz can not connect to it.
> >
> > *My configuration is:* Postgre SQL 7.4.8.
> > *JDBC client database file:* in
> /ofbiz/framework/entity/lib/jdbc called
> > pg74.216.jdbc3.jar
> > *entityengine.xml has being modified to:*
> >
> >  <delegator name="default"
> entity-model-reader="main"
> > entity-group-reader="main"
> entity-eca-reader="main"
> > distributed-cache-clear-enabled="false">
> >         <group-map group-name="org.ofbiz"
> > datasource-name="localpostgres"/>
> >         <group-map group-name="org.ofbiz.odbc"
> > datasource-name="localpostgres"/>
> >     </delegator>
> >
> > Section with localpostgres left unchanged because
> I have *user:*ofbiz with
> > *
> > password:*ofbiz and *database name* is also ofbiz
> > That is all.
> >
> > *Error I have:** Exception:
> org.ofbiz.entity.GenericDataSourceException
> > Message: Unable to esablish a connection with the
> database. Connection was
> > null!*
> >
> > First question - how does entity knows which
> client .jar file to load?
> > Why connection does not work?
> >
> > Best regards,
> >
> > --
> > / ** Вадим К. **/
> >
> >  
> > _______________________________________________
> > Users mailing list
> > [hidden email]
> > http://lists.ofbiz.org/mailman/listinfo/users
> >
> --
> View this message in context:
>
http://www.nabble.com/Users---Using-PostgreSQL-tf1009995.html#a5526865
> Sent from the OFBiz - User forum at Nabble.com.
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Users - Using PostgreSQL

T E Schmitz
In reply to this post by Carl Gleisner
carlj wrote:

>>   I am trying to use Postgre instead of default derby DB. I followed the
>>instructions from Undersun, but have little problem connecting to the
>>database. OFBiz can not connect to it.
>>
>>*My configuration is:* Postgre SQL 7.4.8.
>>*JDBC client database file:* in /ofbiz/framework/entity/lib/jdbc called
>>pg74.216.jdbc3.jar
>>*entityengine.xml has being modified to:*
>>
>>
>>*Error I have:** Exception: org.ofbiz.entity.GenericDataSourceException
>>Message: Unable to esablish a connection with the database. Connection was
>>null!*

Hello Вадим + Carl,
I am running OFBiz with PostgreSQl 7.4. It was pretty straightforward to
set up. I am running an OFBiz revision from last year but hopefully the
following will still be of applicable:

There are only 2 things to set up in OFBiz:
- entityengine.xml
- drop the appropriate driver jar into framework/entity/lib/jdbc

Of course, you need to create the PostgreSQL user + DB before starting
OFBiz:
createuser myuser ...
createdb mydb

The user needs to have the permission to create tables.

In entityengine.xml set up the datasource :

<datasource name="localpostgres"
...
<inline-jdbc
   jdbc-driver="org.postgresql.Driver"            
jdbc-uri="jdbc:postgresql://<my-ip>:5432/mydb"
jdbc-username="myuser"
jdbc-password="mypass"
isolation-level="ReadCommitted"
pool-minsize="2"
pool-maxsize="20"/>

Comment out the jndi-jdbc stuff.

load the seed data:
java -jar ofbiz.jar -install -readers=seed
and to get started the demo data:
java -jar ofbiz.jar -install -readers=demo

Start OFBiz:
./startofbiz.sh

And Bob's your uncle.

--


Regards,

Tarlika Elisabeth Schmitz
Reply | Threaded
Open this post in threaded view
|

Re: Users - Using PostgreSQL

Carl Gleisner
Tarlika,

now I have tried the steps from Opentaps.org and the ones supplied by you earlier and I still get stuck in the verification paragraph of the tutorial at Opentaps.org. I've been discussing another issue with Si Chen and some others and I see some kind of pattern. Don't know if it's Ubuntu (love it) or some human error (me then). My only hope is someone with the same problem. Please keep me posted on any progress

Carl

T E Schmitz wrote
carlj wrote:
>>   I am trying to use Postgre instead of default derby DB. I followed the
>>instructions from Undersun, but have little problem connecting to the
>>database. OFBiz can not connect to it.
>>
>>*My configuration is:* Postgre SQL 7.4.8.
>>*JDBC client database file:* in /ofbiz/framework/entity/lib/jdbc called
>>pg74.216.jdbc3.jar
>>*entityengine.xml has being modified to:*
>>
>>
>>*Error I have:** Exception: org.ofbiz.entity.GenericDataSourceException
>>Message: Unable to esablish a connection with the database. Connection was
>>null!*

Hello Вадим + Carl,
I am running OFBiz with PostgreSQl 7.4. It was pretty straightforward to
set up. I am running an OFBiz revision from last year but hopefully the
following will still be of applicable:

There are only 2 things to set up in OFBiz:
- entityengine.xml
- drop the appropriate driver jar into framework/entity/lib/jdbc

Of course, you need to create the PostgreSQL user + DB before starting
OFBiz:
createuser myuser ...
createdb mydb

The user needs to have the permission to create tables.

In entityengine.xml set up the datasource :

<datasource name="localpostgres"
...
<inline-jdbc
   jdbc-driver="org.postgresql.Driver"            
jdbc-uri="jdbc:postgresql://<my-ip>:5432/mydb"
jdbc-username="myuser"
jdbc-password="mypass"
isolation-level="ReadCommitted"
pool-minsize="2"
pool-maxsize="20"/>

Comment out the jndi-jdbc stuff.

load the seed data:
java -jar ofbiz.jar -install -readers=seed
and to get started the demo data:
java -jar ofbiz.jar -install -readers=demo

Start OFBiz:
./startofbiz.sh

And Bob's your uncle.

--


Regards,

Tarlika Elisabeth Schmitz
Reply | Threaded
Open this post in threaded view
|

RE: Users - Using PostgreSQL

Vinay Agarwal
The verification step, on opentaps.org won't work until pg_hba.conf is modified as specified and postgres has been restarted. Here's what I used just last week to setup postgres 8.1.4
Step 1:
-------
$ su postgres
$ createuser -W ofbiz
$ createdb ofbiz

Step 2:
-------
$psql
<postgres prompt> ALTER USER postgre PASSWORD '<passpostgres>';
<postgres prompt> ALTER USER ofbiz PASSWORD '<passofbiz>';
<postgres prompt> \q

Make sure the <passofbiz> is the same as in entity/config/entityengine.xml

Step 3:
-------
Edit pg_hba.conf to comment out all access lines at the bottom and adding this
host    all    all   127.0.0.1    255.255.255.255    password

Restart postgres typically by
   /etc/rc.d/init.d/postgresql restart

This turns off all local authentication (as in step 2) and requires password for any postgres access.

Step 4: verification
--------------------
$ psql -h localhost -U ofbiz -W

It prompts for password and you should be able to log in.

To reset database during development (THIS WILL DELETE ALL DATA FROM DATABASE)
------------------------------------------------------------------------------
$ psql -h localhost -U postgres -W
<enter password>
DROP SCHEMA PUBLIC CASCADE;CREATE SCHEMA PUBLIC AUTHORIZATION ofbiz;
\q

Regards,
Vinay Agarwal



Reply | Threaded
Open this post in threaded view
|

RE: Users - Using PostgreSQL

Carl Gleisner
Vinay,

from now on you are officially my hero. Step two of your personal tutorial really did the trick. Thank you Vinay.

I would also like to thank everyone else for being very kind and helpful. Guess that's just the way we open source people are.

Long live open source!

Vinay Agarwal wrote
The verification step, on opentaps.org won't work until pg_hba.conf is modified as specified and postgres has been restarted. Here's what I used just last week to setup postgres 8.1.4
Step 1:
-------
$ su postgres
$ createuser -W ofbiz
$ createdb ofbiz

Step 2:
-------
$psql
<postgres prompt> ALTER USER postgre PASSWORD '<passpostgres>';
<postgres prompt> ALTER USER ofbiz PASSWORD '<passofbiz>';
<postgres prompt> \q

Make sure the <passofbiz> is the same as in entity/config/entityengine.xml

Step 3:
-------
Edit pg_hba.conf to comment out all access lines at the bottom and adding this
host    all    all   127.0.0.1    255.255.255.255    password

Restart postgres typically by
   /etc/rc.d/init.d/postgresql restart

This turns off all local authentication (as in step 2) and requires password for any postgres access.

Step 4: verification
--------------------
$ psql -h localhost -U ofbiz -W

It prompts for password and you should be able to log in.

To reset database during development (THIS WILL DELETE ALL DATA FROM DATABASE)
------------------------------------------------------------------------------
$ psql -h localhost -U postgres -W
<enter password>
DROP SCHEMA PUBLIC CASCADE;CREATE SCHEMA PUBLIC AUTHORIZATION ofbiz;
\q

Regards,
Vinay Agarwal