I made a process, where ba online form submittion the whole process happens::

1. A new account is created
2. New postgresql role is created
4. New database is created
5. Rights are granted to the user
6. Database initialization script is called

And this last point makes me troubles. The whole script runs in Tomcat. When the process tries with initialization it is owned ba tomcat6 tomcat6 user. When server calls a process psql dbName < backup.sql, system exits with an error
psql: FATAL: Ident authentication failed for user "username"

After Googling I found out that it is necessary to change pg_hba.conf, to allow localhost login. But it still doesn't work?
How can I trigger a process from Tomcat to initialize postgresql database or dump it to backup.sql?