Results 1 to 3 of 3

Thread: Stored Procedure in Firebird databse (IBase)

  1. #1
    Join Date
    Sep 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Stored Procedure in Firebird databse (IBase)

    I faced with problem executing a stored procedure from my Firebird database.
    I got an error:
    "no permission for execute access to PROCEDURE MyProcedure Could not prepare statement"

    I worked with several in my database and everything was fine. I have created the database in IBExpert tool and I did not fix Roles and users in database. So, I used a SYSDBA name and standard password.

    I got and error during prepare QSQLQuery:
    Qt Code:
    1. QSqlQuery query;
    2. bool result = query.prepare("EXECUTE PROCEDURE MyProcedure (:a)");
    3. QString err = query.lastError().text(); // "no permission for execute access to PROCEDURE...
    4. query.bindValue(":a", 1);
    5. query.exec();
    6. ...
    To copy to clipboard, switch view to plain text mode 

    I have tried to call procedure directly in IBExpert and FlameRobin tools and evething works fine, but using QT 4.5 - no.

    Does anybody had such problem?

    I have used:
    - QT 4.5
    - Firebird 2.1 (embedded server "fbclient.dll")
    - WIN XP SP2
    - connection string : "user id=SYSDBA;password=masterkey;server type=Embedded;auto_commit=True;auto_commit_level=4 096;connection lifetime=1; DataBase=EMPTY.FDB"

  2. #2
    Join Date
    May 2008
    Location
    Kyiv, Ukraine
    Posts
    418
    Thanks
    1
    Thanked 29 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Stored Procedure in Firebird databse (IBase)

    I'm not sure you are calling for last error at the right place. Here is what you do:
    1) prepare the query
    2) find out the last error
    3) execute the query
    I'm a rebel in the S.D.G.

  3. #3
    Join Date
    Sep 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Stored Procedure in Firebird databse (IBase)

    I have found the problem! The problem is during connection to the database.

    I wrote:
    Qt Code:
    1. QSqlDatabase database;
    2. database.setDatabaseName("D:\Test\d1.fdb");
    3. database.setConnectOptions(user id=SYSDBA;password=masterkey;server type=Embedded;auto_commit=True;auto_commit_level=4096;connection lifetime=1; DataBase="D:\Test\d1.fdb");
    To copy to clipboard, switch view to plain text mode 

    But should be:
    Qt Code:
    1. QSqlDatabase database;
    2. database.setDatabaseName("D:\Test\d1.fdb");
    3. database.setUserName("SYSDBA");
    4. database.setPassword("masterkey");
    5. database.setConnectOptions(server type=Embedded;auto_commit=True;auto_commit_level=4096;connection lifetime=1; DataBase="D:\Test\d1.fdb");
    To copy to clipboard, switch view to plain text mode 

    So, we should set User name and Password using methods "setUserName", "setPassword". That is why I did not have permissions to execute procedures.

Similar Threads

  1. Stored procedure and ODBC
    By filya in forum Qt Programming
    Replies: 2
    Last Post: 15th March 2010, 08:40
  2. Problem calling stored procedure.. Help!
    By triperzonak in forum Qt Programming
    Replies: 4
    Last Post: 15th March 2010, 08:34
  3. Cannot create MySQL stored procedure / views from Qt
    By pshah.mumbai in forum Qt Programming
    Replies: 8
    Last Post: 8th October 2008, 16:22
  4. Accessing array (TABLE TYPE) in Stored Procedure from Qt
    By sureshbabu in forum Qt Programming
    Replies: 0
    Last Post: 26th September 2007, 11:36
  5. no record returns from stored procedure
    By mandal in forum Qt Programming
    Replies: 0
    Last Post: 26th April 2007, 14:45

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.