PostgreSQL/PostGIS + WWW SQL Designer + gvSIG (III)

Facebooktwittergoogle_plusredditpinterestlinkedinmail


[In English]
Para terminar con esta serie de posts, esta es mi experiencia con WWW SQL Designer:

  • WWW SQL Designer permite importar una BD de un servidor en el entorno de diseño, pero no permite exportar un diseño directamente sobre una BD en un servidor. Para importar tu diseño en una BD, la opción más sencilla es Save/Load -> Generate SQL (seleccionar el SQL apropiado para la BD que uses) -> Copiar el código (recomendable guardarlo en fichero) -> Abrir la BD y ejecutar el SQL.
  • Estoy usando lampp, así que eso influye en dónde están instalados php y WWW SQL Designer.
  • Instrucciones de instalación:

https://code.google.com/p/wwwsqldesigner/wiki/Installation

  • Modificaciones a las instrucciones de instalación:

create user “sqlExample” with password ‘mypasswd’;

grant all privileges on database “sqlDesignerExample” TO “sqlExample” with grant option;

  • Modificaciones en fichero index.php en /opt/lampp/htdocs/wwwsqldesigner-2.7/backend/php-postgresql/index.php

// Parameters for the application database

function setup_saveloadlist() {

Define(“HOST_ADDR”, “localhost”);            // if the database cluster is on the same server as this application use ‘localhost’ otherwise the appropriate address (192.168.0.2 for example).

Define(“PORT_NO”, “5432”);                    // default port is 5432. If you have or had more than one db cluster at the same time, consider ports 5433,… etc.

Define(“DATABASE_NAME”, “sqlDesignerExample”);     // leave as is

Define(“USER_NAME”, “sqlExample”);        // leave as is

Define(“PASSWORD”, “mypasswd”);                    // leave as is

Define(“TABLE”, “wwwsqldesigner”);            // leave as is

}

// Parameters for the database you want to import in the application

function setup_import() {

Define(“HOST_ADDR”, “localhost”);    // if the database cluster is on the same server as this application use ‘localhost’ otherwise the appropriate address (192.168.0.2 for example).

Define(“PORT_NO”, “5432”);            // default port is 5432. If you have or had more than one db cluster at the same time, consider ports 5433,… etc.

Define(“DATABASE_NAME”, “mybd”);    // the database you want to import

Define(“USER_NAME”, “postgres”);    // role having rights to read the database

Define(“PASSWORD”, “mypasswd”);        // password for role

  • Para activar php

Cambiar php.ini: sudo leafpad php.ini en /opt/lampp/etc (leafpad es el editor que yo uso, puede emplearse cualquier otro)

La extensión que hay que descomentar es extension=”pgsql.so” (esa extensión está en /opt/lampp/lib/php/extensions/no-debug-non-zts-20121212 y /usr/lib/php5/20121212)


[En español]
Let’s finisht this set of posts with WWW SQL Designer:

  • WWW SQL Designer allows to import a DB from a server into the design environment, but the other way round (exporting the design directly into the DB server) is not possible.  For importing your design into a DB, the easiest option is Save/Load -> Generate SQL (you should use the proper SQL for your DB) -> Copy that code (it is a good idea to keep it in a file) -> Open your DB and run that code.
  • I am using lampp, so the installation path of php and WWW SQL Designer is related to lampp.
  • Installation instructions:

https://code.google.com/p/wwwsqldesigner/wiki/Installation

  • Some modifications to these instructions:

create user “sqlExample” with password ‘mypasswd’;

grant all privileges on database “sqlDesignerExample” TO “sqlExample” with grant option;

  • Some modifications on file index.php at /opt/lampp/htdocs/wwwsqldesigner-2.7/backend/php-postgresql/index.php

// Parameters for the application database

function setup_saveloadlist() {

Define(“HOST_ADDR”, “localhost”);            // if the database cluster is on the same server as this application use ‘localhost’ otherwise the appropriate address (192.168.0.2 for example).

Define(“PORT_NO”, “5432”);                    // default port is 5432. If you have or had more than one db cluster at the same time, consider ports 5433,… etc.

Define(“DATABASE_NAME”, “sqlDesignerExample”);     // leave as is

Define(“USER_NAME”, “sqlExample”);        // leave as is

Define(“PASSWORD”, “mypasswd”);                    // leave as is

Define(“TABLE”, “wwwsqldesigner”);            // leave as is

}

// Parameters for the database you want to import in the application

function setup_import() {

Define(“HOST_ADDR”, “localhost”);    // if the database cluster is on the same server as this application use ‘localhost’ otherwise the appropriate address (192.168.0.2 for example).

Define(“PORT_NO”, “5432”);            // default port is 5432. If you have or had more than one db cluster at the same time, consider ports 5433,… etc.

Define(“DATABASE_NAME”, “mybd”);    // the database you want to import

Define(“USER_NAME”, “postgres”);    // role having rights to read the database

Define(“PASSWORD”, “mypasswd”);        // password for role

  • php activation:

Change php.ini: sudo leafpad php.ini en /opt/lampp/etc (leafpad is my text editor, of course you can use any other)

The extension to be uncommented is  extension=”pgsql.so” (it can be found at /opt/lampp/lib/php/extensions/no-debug-non-zts-20121212 and /usr/lib/php5/20121212)