CMDBuild Forum

Re: [OpenMaint DB] Cannot import .backup file. Locale issue?

Hello,

I've setup correctly tomcat and postgres, but haven't been able to import the openmaint-empty.backup file into a database. 

As postgres user, i try running: 

  • psql -U postgres openmaint_test_db_1 < share/openmaint/database/openmaint-empty.backup

As a result, the output is a series of errors and funny characters, and nothing gets created in the database. 

I tried the former command into a db with Encoding and Locale set to LATIN1 and es_ES.ISO88591 respectively, And also to one db set to UTF-8 and es_ES.UTF-8, with no luck on either one.

The reason i tried using LATIN1 is that converting the .backup file with iconv from LATIN1 to UTF-8, does not throw an error. So i thought the original db might've been enconded as such.  

I think it's related to the locale of my setup, but i lack experience and knowledge on the subject to correctly diagnose the issue. 

If i run locale, i get the following list:

  • LANG=es_ES.UTF-8
  • LANGUAGE=
  • LC_CTYPE="es_ES.UTF-8"
  • LC_NUMERIC="es_ES.UTF-8"
  • LC_TIME="es_ES.UTF-8"
  • LC_COLLATE="es_ES.UTF-8"
  • LC_MONETARY="es_ES.UTF-8"
  • LC_MESSAGES="es_ES.UTF-8"
  • LC_PAPER="es_ES.UTF-8"
  • LC_NAME="es_ES.UTF-8"
  • LC_ADDRESS="es_ES.UTF-8"
  • LC_TELEPHONE="es_ES.UTF-8"
  • LC_MEASUREMENT="es_ES.UTF-8"
  • LC_IDENTIFICATION="es_ES.UTF-8"
  • LC_ALL=

If i run locale -a, i get the following:

  • C
  • C.UTF-8
  • en_US.iso88591
  • en_US.utf8
  • es_ES.iso88591
  • es_ES.utf8
  • POSIX

I added and generated en_US.iso88591 and es_ES.iso88591 in an effort to import the db. No luck.

I also installed phpPgAdmin and tried to import from there, both as file upload and pasting directly the contents of the .backup file into the sql query field, with no success. 

i'm running Ubuntu server 14.04.1 32bits, on a VM in virtual box.

All the packages have been installed using apt-get.

I really appreciate any light you can shed on the issue and any help you knowledgeable guys can provide. 

Thanks in advance for your time!

PS: For those of you interested, here's the full output of the psql command, from less:

Solved.
Correct command was:
  • pg_restore -d db_name openmaint-empty.backup
AFTER creating the postgres user "shark". 
If that user is not created, i got some errors during the db creation process. 
 
I leave this here in case it helps another inexperienced user.
 
Thank you everybody! 
 
 
Previously Francisco wrote:

Hello,

I've setup correctly tomcat and postgres, but haven't been able to import the openmaint-empty.backup file into a database. 

As postgres user, i try running: 

  • psql -U postgres openmaint_test_db_1 < share/openmaint/database/openmaint-empty.backup

As a result, the output is a series of errors and funny characters, and nothing gets created in the database. 

I tried the former command into a db with Encoding and Locale set to LATIN1 and es_ES.ISO88591 respectively, And also to one db set to UTF-8 and es_ES.UTF-8, with no luck on either one.

The reason i tried using LATIN1 is that converting the .backup file with iconv from LATIN1 to UTF-8, does not throw an error. So i thought the original db might've been enconded as such.  

I think it's related to the locale of my setup, but i lack experience and knowledge on the subject to correctly diagnose the issue. 

If i run locale, i get the following list:

  • LANG=es_ES.UTF-8
  • LANGUAGE=
  • LC_CTYPE="es_ES.UTF-8"
  • LC_NUMERIC="es_ES.UTF-8"
  • LC_TIME="es_ES.UTF-8"
  • LC_COLLATE="es_ES.UTF-8"
  • LC_MONETARY="es_ES.UTF-8"
  • LC_MESSAGES="es_ES.UTF-8"
  • LC_PAPER="es_ES.UTF-8"
  • LC_NAME="es_ES.UTF-8"
  • LC_ADDRESS="es_ES.UTF-8"
  • LC_TELEPHONE="es_ES.UTF-8"
  • LC_MEASUREMENT="es_ES.UTF-8"
  • LC_IDENTIFICATION="es_ES.UTF-8"
  • LC_ALL=

If i run locale -a, i get the following:

  • C
  • C.UTF-8
  • en_US.iso88591
  • en_US.utf8
  • es_ES.iso88591
  • es_ES.utf8
  • POSIX

I added and generated en_US.iso88591 and es_ES.iso88591 in an effort to import the db. No luck.

I also installed phpPgAdmin and tried to import from there, both as file upload and pasting directly the contents of the .backup file into the sql query field, with no success. 

i'm running Ubuntu server 14.04.1 32bits, on a VM in virtual box.

All the packages have been installed using apt-get.

I really appreciate any light you can shed on the issue and any help you knowledgeable guys can provide. 

Thanks in advance for your time!

PS: For those of you interested, here's the full output of the psql command, from less:

 

I needed to move a backup from a cmdbuild instance to antoher and use PGAdmin III (freeware tool)
 
And all correct
 
@errecepe
 
 
Previously Francisco wrote:
Solved.
Correct command was:
  • pg_restore -d db_name openmaint-empty.backup
AFTER creating the postgres user "shark". 
If that user is not created, i got some errors during the db creation process. 
 
I leave this here in case it helps another inexperienced user.
 
Thank you everybody! 
 
 
Previously Francisco wrote:

Hello,

I've setup correctly tomcat and postgres, but haven't been able to import the openmaint-empty.backup file into a database. 

As postgres user, i try running: 

  • psql -U postgres openmaint_test_db_1 < share/openmaint/database/openmaint-empty.backup

As a result, the output is a series of errors and funny characters, and nothing gets created in the database. 

I tried the former command into a db with Encoding and Locale set to LATIN1 and es_ES.ISO88591 respectively, And also to one db set to UTF-8 and es_ES.UTF-8, with no luck on either one.

The reason i tried using LATIN1 is that converting the .backup file with iconv from LATIN1 to UTF-8, does not throw an error. So i thought the original db might've been enconded as such.  

I think it's related to the locale of my setup, but i lack experience and knowledge on the subject to correctly diagnose the issue. 

If i run locale, i get the following list:

  • LANG=es_ES.UTF-8
  • LANGUAGE=
  • LC_CTYPE="es_ES.UTF-8"
  • LC_NUMERIC="es_ES.UTF-8"
  • LC_TIME="es_ES.UTF-8"
  • LC_COLLATE="es_ES.UTF-8"
  • LC_MONETARY="es_ES.UTF-8"
  • LC_MESSAGES="es_ES.UTF-8"
  • LC_PAPER="es_ES.UTF-8"
  • LC_NAME="es_ES.UTF-8"
  • LC_ADDRESS="es_ES.UTF-8"
  • LC_TELEPHONE="es_ES.UTF-8"
  • LC_MEASUREMENT="es_ES.UTF-8"
  • LC_IDENTIFICATION="es_ES.UTF-8"
  • LC_ALL=

If i run locale -a, i get the following:

  • C
  • C.UTF-8
  • en_US.iso88591
  • en_US.utf8
  • es_ES.iso88591
  • es_ES.utf8
  • POSIX

I added and generated en_US.iso88591 and es_ES.iso88591 in an effort to import the db. No luck.

I also installed phpPgAdmin and tried to import from there, both as file upload and pasting directly the contents of the .backup file into the sql query field, with no success. 

i'm running Ubuntu server 14.04.1 32bits, on a VM in virtual box.

All the packages have been installed using apt-get.

I really appreciate any light you can shed on the issue and any help you knowledgeable guys can provide. 

Thanks in advance for your time!

PS: For those of you interested, here's the full output of the psql command, from less: