Printer FriendlyEmail Article Link

Informix: How do I give a user ability to connect to database and run queries?


You grant the user privileges.  The user must have a valid unix account on the server.

To allow a user to connect to database.  As owner of the database or user who has permission currently issue:

  • echo "grant connect to <username>" | dbaccess <databasesname>

Where <databasename> is the name of the database.  <username> is the user who requires ability to connect.

To allow user to run queries on specific tables:

  • echo "grant select on <table> to '<username>' as '<owneroftable>' " | dbaccess <databasename> 

Where <table> is the table.  <username> is the user who requires select ability.  <owneroftable> is the owner of the table. <databasename> is the name of the database

NOTE: If the table has PUBLIC privileges, the second step is not necessary.  (dbschema will show)
NOTE: Other abilities such as insert, delete, update can be added in the same manner as the second step.  Substitute "select" with desired action.

Dbschema format:

dbschema -d <databasename> -t <tablename> -ss

Product : UNIX,Informix