Board index » delphi » Help! adding users via SQL

Help! adding users via SQL

Quote
Michael-John Turner <m...@phantom.eri.uct.ac.za> wrote:
>Hi all

>I am using Delphi 3.0 and SQL Anywhere 5.5.01 (via ODBC). I would like
>to be able to add users from within my system. Hoewever, when I try
>and GRANT CONNECT them I get a
>"General SQL Error
>[Sybase][ODBC Driver]Unable to connect to database server: authentication
>violation"

Oh I know this error ...

Quote

>The exact syntax I'm using is:
>grant connect to joe

>This happens both from within my application (after I have logged in as
>a DBA) and from within the Delphi Database Explorer (entering the SQL
>directly).

In my opinion the reason is the ODBC driver. It is not possible to
fire any of those statements like 'GRANT', 'CREATE PROC...' ...
(DDL-Statements).

Quote
>I have no problems adding users from within ISQL and SQL
>Central.

These tools are native connected to the db.

[Snip]

If there is a way to meet the goal -> please let me know.

Henrik

 --------------------------------------------------------------------
|Henrik Bachmann                                                     |
|D-39120 Magdeburg (Germany)                                         |
|                                                                    |
|EMail:   Henrik.Bachm...@pc.mdlink.de                               |
 --------------------------------------------------------------------

 

Re:Help! adding users via SQL


Hi all

I am using Delphi 3.0 and SQL Anywhere 5.5.01 (via ODBC). I would like
to be able to add users from within my system. Hoewever, when I try
and GRANT CONNECT them I get a
"General SQL Error
[Sybase][ODBC Driver]Unable to connect to database server: authentication
violation"

The exact syntax I'm using is:
grant connect to joe

This happens both from within my application (after I have logged in as
a DBA) and from within the Delphi Database Explorer (entering the SQL
directly). I have no problems adding users from within ISQL and SQL
Central. I have tried using the sp_addlogin stored procedure to add a user,
but I get exactly the same error message. If I specify a passwd
(grant connect to joe identified by password) I get the same message.

In fact, all the permutations of the grant command from within Delphi/
Database Explorer (eg "grant dba to mj", where mj exists) seem to fail
with the same error message ;(((

I need to get this working ASAP.  Help!!!

Cheers
 M-J
--
Michael-John Turner       |  http://www.edr.uct.ac.za/~mj/
mjtur...@icon.co.za       |  Linux @ UCT -> http://www.leg.uct.ac.za/
m...@phantom.eri.uct.ac.za  |  PGP key via mail, WWW or finger @phantom

Re:Help! adding users via SQL


Quote
Michael-John Turner wrote:
> I am using Delphi 3.0 and SQL Anywhere 5.5.01 (via ODBC). I would like
> to be able to add users from within my system. Hoewever, when I try
> and GRANT CONNECT them I get a
> "General SQL Error
> [Sybase][ODBC Driver]Unable to connect to database server: authentication
> violation"

> The exact syntax I'm using is:
> grant connect to joe       There is a trick to do so : EXECUTE IMMEDIATE 'GRANT CONNECT TO' ||NameOfUser

I use it inside a storedProc which receives NameOfUser as parameter.  Two drawbacks:
1- You have to make sure you have DBA's autority to do so
2- You cannot translate this code to TRANSAC-SQL, since it is a WATCOM-SQL private
statement.
--
Jean-Francois Claeys
Programmeur Gestion Infopharm
http://www.dsuper.net/~jfranc

Re:Help! adding users via SQL


Quote
Michael-John Turner wrote:
> I am using Delphi 3.0 and SQL Anywhere 5.5.01 (via ODBC). I would like
> to be able to add users from within my system. Hoewever, when I try
> and GRANT CONNECT them I get a
> "General SQL Error
> [Sybase][ODBC Driver]Unable to connect to database server: authentication
> violation"

> The exact syntax I'm using is:
> grant connect to joe       There is a trick to do so : EXECUTE IMMEDIATE 'GRANT CONNECT TO' ||NameOfUser

I use it inside a storedProc which receives NameOfUser as parameter.  Two drawbacks:
1- You have to make sure you have DBA's autority to do so
2- You cannot translate this code to TRANSAC-SQL, since it is a WATCOM-SQL private
statement.
--
Jean-Francois Claeys
Programmeur Gestion Infopharm
http://www.dsuper.net/~jfranc

Other Threads