I have a third-party Sybase database, which my users would like to connect to and query from a Linux box, using iSQL. I have installed UnixODBC and FreeTDS. As it is third-party database however, I am not able to perform any GRANTs. The query fails with iSQL on Linux:

[42501][unixODBC][FreeTDS][SQL Server]ASA Error -121: Permission denied: you do not have permission to use the "CREATE PROCEDURE" statement

It appears that the actual SQL that is getting sent by iSQL is CREATE PROCEDURE <some temporary name> AS <the actual sql>. I have read the iSQL and FreeTDS manpages but there is no hint in there about how to disable this behavior.

This works OK in Python:

>>> import Sybase
>>> db = Sybase.connect('host:port', 'user', 'password', 'db')
>>> c = db.cursor()
>>> c.execute('select table_name from systable')
>>> len(c.fetchall())

So I believe I have installed the Sybase client libraries correctly. Before I recommend this solution instead, can I as a DBA do anything about fixing iSQL?

  • Did you ever get this resolved Gaius?
    – jcolebrand
    Feb 17 '11 at 0:09
  • No, I am probably going to have to bother our people who do such things about licensing the DataDirect ODBC driver :-/
    – Gaius
    Feb 17 '11 at 7:12
  • Did you ask on the iSQL list? Sounds like a bug to me. Also can you get "CREATE PROCEDURE" permission on the database? That would solve the issue. Jun 13 '11 at 16:36
  • The database is operated and supported by a third party, I can only issue SELECTs against it I'm afraid
    – Gaius
    Jun 13 '11 at 17:48
  • Hi @Gaius, was licensing the DataDirect ODBC driver how you ended up resolving this?
    – Andrew
    Mar 26 '13 at 16:12

I have seen this before. According to the Sybase ASE Documentation:

Adaptive Server Enterprise implements dynamic SQL using temporary stored procedures. A temporary stored procedure is created when a SQL statement is prepared, and destroyed when that prepared statement is deallocated...[a]s a consequence of this implementation, an application accessing Adaptive Server and using dynamic SQL is subject to the restrictions of Adaptive Server stored procedures.

However, I'm not sure if it's the unixODBC interface, or the isql tool, that is asking the ASE to treat these as stored procedures / dynamic sql.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.