Posts Tagged ‘FOSS’

Admin Scripts in pgdb

Posted: February 6, 2008 in FOSS, Techstuff
Tags: , ,

In my project there was need for writing few admin scripts in python to create database account and database for a user.
In case of MySQL we connected to mysql database (admin database) and then performed the DDL queries like create database.The connection string we used is
conn=mysql.connect(host=”localhost”,user=”username”,passwd=” “,db=”mysql” )
.
It worked well.In the same way we wrote code for creating database in postgres is as follows:

import pgdb
conn=pgdb.connect(‘localhost:postgres:postgres:password’)
cursor=conn.cursor()
cursor.execute(‘create database test’)
cursor.close()
conn.close()

here postgres is the admin database.
But the create database didn’t work. The following error was thrown.

ERROR: CREATE DATABASE: May not be called in a transaction block

ie., we are not allowed to create database in the transaction block. Later found that doing a commit will end or close the current transaction and hence after a commit we performed create database.It worked then. In order to do that we just included a line

cursor.execute(‘COMMIT’)

before the line cursor.execute(‘create database test’)

Thus we can just do a commit before issuing any statements that PostgreSQL cannot execute within a transaction and perform such statements outside the transaction block.

Advertisements

FStival’07-a Software Freedom festival

Posted: September 15, 2007 in FOSS
Tags: ,

Today(September 15th) we celebrated a festival FStival’07 in our college which is a part of Software Freedom Day celebration. The function started around 10 am. The foss enthusiasts and our alumni Mr. Praveen, Mr. Senthilkumaran, Mr. Subramani also participated in it and made it a successful celebration.

The welcome address was given by Mrs.Shalinie, HOD of our department. Then the presidential address was given by Mr. Rajaram, Dean of Computer Sciences. Then the report on GLUGOT and GLUG-Madurai was given by my friend Keerthi. The next was a talk by Mr.Praveen an alumnus of our college who is now working in HP, Bangalore. He gave a wonderful talk on what is FOSS, said how it differs from the proprietary software and how it is useful in educational institutions, industries and listed the companies using GNU/Linux. That was continued by Ubuntu installation demo and a demo on looking glass and compiz fusion showed by Mr. Subramani – another alumnus of our college. After few minutes break there was demo on various GNU/Linux tools in the stalls in our department. Some of the tools that were demonstrated : GCC , LAMP, CMS (Drupal) , LaTeX, GIMP , Emacs , Databases , Open Office , Debuggers , GTK/Glade , KDevelop , Beryl(one of the stalls that attracted many ppl), VIM, Games(Supertux). These demos were done by our second and third year students. They really did a good job and hats off to them. I and my friends just visited all the stalls and enjoyed it.

All the stalls were closed around 1.30 and there was a little photo session. Then the hunger started killing us as we didn’t have the breakfast also and we started to Bell hotel where there was a treat by our seniors(Praveen,Senthil and Subramani). We filled our tummies and had lot of fun there. Then on return, myself and Keerthi went to vinayagar temple in our college and reached hostel.Thus it was a wonderful day 🙂