Installing native pg gem on Mountain Lion

I tried to install the native pg gem on Mac OS X Mountain Lion (10.8.2): gem install pg and got this exception: Building native extensions. This could take a while… ERROR: Error installing pg: ERROR: Failed to build gem native extension. /Users/robertreiz/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb checking for pg_config… yes Using config values from /usr/bin/pg_config checking for libpq-fe.h…Continue reading “Installing native pg gem on Mountain Lion”

Access PostgreSQL from outside

After you installed PostgreSQL on a debian server, by default it is not accessible from outside. From other servers! It is just accessible from localhost. To change that you need to make it listen to a special ip address and port. On Debian 6 you have to switch to this directory: /etc/postgresql/8.4/main Here are theContinue reading “Access PostgreSQL from outside”

Setting password for PostgreSQL

After a standard installation of PostgreSQL on Debian linux, there is no password set for the default user postgres. You can set the password by login in as postgres user. If you are root, just type in that: su postgres Than you can start the postgres client: psql And now execute this command here toContinue reading “Setting password for PostgreSQL”

Showing Indexes in Postgresql

OK. If you want to see the indexes to a table in Postgresql you can do this here: \d <TABLENMAE> If that is not showing what you expected you can do this short sql statement. That shows all indexes which are beginning with “not”. I heard from other database where you just have to typeContinue reading “Showing Indexes in Postgresql”

PSQLException: The column index is out of range: 1, number of columns: 0

I tried to write a insert statement with Spring JDB Template for an PostgreSQL Database. My insert string looked like this: final String sql = “INSERT INTO products (prod_name, prod_key, artifact_id, group_id, link, src, prod_type) VALUES (‘?’,’?’,’?’,’?’,’?’,’?’,’?’)”; And I got this Exception: PreparedStatementCallback; SQL []; The column index is out of range: 1, number ofContinue reading “PSQLException: The column index is out of range: 1, number of columns: 0”

psql client for PostgreSQL

psql is a command line client for the PostgreSQL Database Engine. If you install postgreSQL on Debian psql is installed by default. After you switched to the postgteSQL user: su postgres you can access the client with this simpel command: psql and you can exit with this command: \q You can set a password withContinue reading “psql client for PostgreSQL”

Installing PostgreSQL 8.3 on Debian Linux (leny)

Installing PostgreSQL 8.3 on Debian Linux is pretty easy. With this command it is done. apt-get install postgresql-8.3 Now the DB system is installed under: /etc/postgresql/8.3/ You can see the status of the RDBMS with this command: /etc/init.d/postgresql-8.3 status You can start it /etc/init.d/postgresql-8.3 start and you can stop it /etc/init.d/postgresql-8.3 stop After the successfulContinue reading “Installing PostgreSQL 8.3 on Debian Linux (leny)”

MySQL to PostgresSQL migration

Today I migrated a 10 MB database from MySQL to PostgresSQL. I used the “ESF Database Migration Toolkit – Standard 6.5.06”. It works pretty good for me. I access the database with a spring/hibernate based java application. After some litle changes on the applicationContext.xml I could successfully start my app and access the postgresSQL database.Continue reading “MySQL to PostgresSQL migration”