how to grant user using sqlexp

Posted by Richard.Kelters on 09-Sep-2014 04:46

Hi,

Is it possible to grant users using sqlexp on Linux? If so how or point me to the documentation I'm unable to find.

I've added sysprogress as user and sqlexp can show me data but I'm unable to grant rights. And I was also unable to find how to grant read-only rights. Another question I have does the sql user need to be in the _user table?

Richard

Posted by Paul Koufalis on 09-Sep-2014 08:32

The command line should be something like this:

DB=sports

PORT=sqlsports  # as defined in /etc/services

URL="jdbc:datadirect:openedge://localhost:-1;databaseName=$DB"

URL="${URL};servicename=$PORT;User=Paul;Password=TheWiz!"

URL="${URL};defaultSchema=pub"

sqlexp -driverUrl "$URL" -infile $SCRIPTDIR/update_grants.$DB.sql -sqlverbose

update_grants_sports.sql should look like this:

GRANT SELECT ON PUB."customer" TO bob;

GRANT SELECT ON PUB."customer" TO jane;

GRANT SELECT ON PUB."customer" TO mike;

COMMIT;

All Replies

Posted by Abri Venter on 09-Sep-2014 04:56

Hallo

In the pdf documentation you can have a look at OpenEdge Data Management: SQL Development. for V11.3 on page 65.

This explains the GRANT statement.

By default sysprogress will exist and also the user that created the database.

There is VST tables you can check to see what has been assigned. _sysdbauth _systabauth _sysfldauth.

Thank you

A Venter

Posted by Libor Laubacher on 09-Sep-2014 06:25
Posted by Richard.Kelters on 09-Sep-2014 08:23

What I'm missing in the documentation is how sqlexp on Linux should work or look like. For instance after 'grant dba to "user1";' enter, 'grant resource to "user1";' enter, then 'commit;' enter and close with 'exit' and enter. I can't find (knwoledgebase or docs) if this is correct. After trying it like this and start sqlexp as user1 I get 'no access'.

I'll give it another try tonight, maybe I did something wrong. Thanks for the replies!

Posted by Paul Koufalis on 09-Sep-2014 08:32

The command line should be something like this:

DB=sports

PORT=sqlsports  # as defined in /etc/services

URL="jdbc:datadirect:openedge://localhost:-1;databaseName=$DB"

URL="${URL};servicename=$PORT;User=Paul;Password=TheWiz!"

URL="${URL};defaultSchema=pub"

sqlexp -driverUrl "$URL" -infile $SCRIPTDIR/update_grants.$DB.sql -sqlverbose

update_grants_sports.sql should look like this:

GRANT SELECT ON PUB."customer" TO bob;

GRANT SELECT ON PUB."customer" TO jane;

GRANT SELECT ON PUB."customer" TO mike;

COMMIT;

Posted by Richard.Kelters on 09-Sep-2014 09:13

Thanks a lot Paul!

Posted by gus on 09-Sep-2014 10:24

this is what i have used in some of my scripts for UNIX and Linux (requires that a server be started first. SQL cannot be used in single-user mode):

sqlexp ${DB_NAME} -S ${DB_PORT} <<-HERE_EOF

       create user '${DB_USERID}', '${DB_PASSWORD}';
       grant dba,resource to '${DB_USERID}';
       commit;
quit;
HERE_EOF


to give somebody just read access, you grant them the SELECT privilege on a table.

Posted by Richard.Kelters on 11-Sep-2014 06:00

Thanks Paul and Gus!

This thread is closed