How to setup postgres database for POS ACTIVEMQ

From iDempiere en

This page can contain obsolete information

Phase 1

PostgreSQL, the world's most advanced open source database, often simply "Postgres", is an object-relational database management system (ORDBMS) with an emphasis on extensibility and standards-compliance.

So we want have our POS_ACTIVEMQ run with Postgresql as back end database. Obviously, we need it installed. All what am going to say here is all over the internet. Allow me to propose the link I used https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-12-04 .

This is what you need to get started.

  • Download the server PostgreSQL download and install it.
  sudo apt-get install postgresql postgresql-contrib 

This my brother will install the latest version available in your Ubuntu release and the commonly used add-ons for it.

  • Download the JDBC driver PostgreSQL JDBC Driver according to your version and install it.
  sudo apt-get install postgresql libpg-java
  • You can also install the PosgreSQL administration tool pgAdminIII.
  sudo apt-get install pgadmin3

I'm joking, you ought to install pgadmin3.

Phase 2: Start web server

A Web server, can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver web content that can be accessed through the Internet.

As a database server, postgres primary function is to store data, securely and supporting best practices, and retrieve it later, as requested by other software applications, be it those on the same computer or those running on another computer across a network (including the Internet).

Next, to get started, we need to change the PostgreSQL postgres user password; we will not be able to access the server otherwise. As the “postgres” Linux user, we will execute the psql command.

In a terminal, type:

 sudo -u postgres psql postgres

Set a password for the "postgres" database role using the command:

\password postgres

and give your password when prompted. The password text will be hidden from the console for security purposes.

Type

 Control+D 

to exit the posgreSQL prompt.

  • Create database:

To create the first database, which we will call "leo", simply type:

 sudo -u postgres createdb leo
  • Install Server Instrumentation (for PgAdmin) for Postgresql 9.1

PgAdmin requires the installation of an add-on for full functionality. The "adminpack" addon, which it calls Server Instrumentation, is part of postgresql-contrib, so you must install that package. Then to activate the extension,

For ""Postgresql 9.1""+ install the adminpack "extension" in the "postgres" database:

  sudo -u postgres psql;CREATE EXTENSION adminpack;
  • Using pgAdmin III GUI

To get an idea of what PostgreSQL can do, you may start by firing up a graphical client. In a terminal type :

  pgadmin3


alt

You will be presented with the pgAdmin III interface. Click on the "Add a connection to a server" button (top left).

alt text



In the new dialog:

  • enter the address 127.0.0.1
  • host is jdbc:postgresql://localhost:5432/postgres
  • the default database ("leo" in the example above)
  • your username ("postgres") and your password.

One more step is required in order to allow pgAdmin III to connect to the server, and that is to edit pg_hba.conf file and change the authentication method from peer to md5 (Will not work if you have not set the password.):

  sudo nano /etc/postgresql/9.1/main/pg_hba.conf

and change the line

  # Database administrative login by Unix domain socket
  local   all             postgres                                peer

to

  # Database administrative login by Unix domain socket
  local   all             postgres                                md5

Now you should reload the server configuration changes and connect pgAdmin III to your PostgreSQL database server.

    sudo /etc/init.d/postgresql reload

with this GUI you may start creating and managing databases, query the database, execute SQl etc.

Please forgive my selfishness as I took care solely of mine computer but this is the link I followed, https://help.ubuntu.com/community/PostgreSQL. So then, have fun.

Phase 3: Run POS_ACTIVEMQ with postgres

When you run the POS for the first time it detects that you don't have any database installed so it will do it for you. So kawaii !!

  • The code to do that is written in appConfig.java of the POS. A day before doing this I thought I will have to write the connection code myself but no ... this is the best software in the world the codes are already there, commented waiting for the day you will unleash them. Obviously you ought to comment the, mark my words, 4 derby codes.


  • But that is not all when you run it, it will tell you something is wrong with the drivers and that's because we did not link/copy them to the lib of POS. Just do that then you do a library mapping in eclipse.
  java.lang.ClassNotFoundException: org.postgresql.Driver
  • Now guess what you'll have another problem the database you cannot access because the word secret you do not posses.


Easily solved. The error window will lead to an information window. You have to

Firstly, change the host to

jdbc:postgresql://localhost:5432/postgres

Secondly,

 change the user name and the password 

Finally,

Save, close and restart. 

Voilà c'est tout! Prochainement, How to enter products in the inventory.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.