Previous: , Up: Postgresql   [Index]


7.4 Examples for accessing Postgresql

The examples assume that there is a database named test and you have the necessary rights to access it without password (probably the database is on a server at the local machine) as the default user, i.e. the user with the same name as your current operating system account.

Each example contains code for cleaning up, but, for more clarity, the cleanup is not enforced with Octaves unwind_protect or with an SQL transaction. If something goes wrong, you can drop the database test – this should assure purging any created large objects.

You can also type demo pq_connect to access some demo code. But it is possibly more difficult to read. test pq_connect runs some functionality tests. The preconditions (access to a database named test) are the same as for the code in the current section.