Printer FriendlyEmail Article Link

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

Answer

You grant the user privileges.  The user you want to grant permissions must have a valid unix account on the server.  

To allow a user to connect to database.  As owner or dba of the database issue:

  • echo "grant connect to userid" | dbaccess database
    Where:
    userid is the user account you want to grant permission to.
    database is the database you want to grant permission to.  (Example: metro, scout, react_2001)
Note: Only the dba of the database can grant connect permission to the database. Use dbschema to see which user(s) have dba privilege.  Typically the informix user is dba of the metro database and smartsys is dba of the scout database and hlisys is dba of react_2001 database.  

To allow user to run queries on specific tables.  As owner of the table or as dba user issue:

  • echo "grant select on table to 'userid' as 'owner-of-table' " | dbaccess database

    Where:
    table is the table you want to grant permission to.
    userid is the user account you want to grant permission to.
    owner-of-table is the owner of the table you are granting permission to.  Use dbschema to determine owner if do not know.
    database is the database the table resides in.
     

     

    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:

    This will show the dbscheme for all components of database:
    dbschema -d database -ss
    Where:
    database is the database.

    This will show the dbscheme for table specified in the database:
    dbschema -d database -t table -ss
    Where:
    database is the database.
    table is the table.

Product : UNIX,Informix