Results 1 to 20 of 20

Thread: QOpenOCCI Oracle SQL Plugin

  1. #1
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QOpenOCCI Oracle SQL Plugin

    Hello, I am looking for anyone how may be interested in testing/trying/breaking a Qt SQL plugin for Oracle. This project is new so any feedback I get is good feedback.

    From the project webpage...

    "QOpenOCCI is a Qt SQL Plugin for Oracle released under the LPGL that can be used by all editions of Qt (Free/Open/Commercial). QOpenOCCI will strive to be a free, production ready, alternative to any similar proprietary solution. QOpenOCCI is built using Oracle's C++ OCCI libraries (1.11.0) and Trolltech's Qt (4.3.3)."

    The project is hosted at https://sourceforge.net/projects/qopenocci/.

    Thanks, a_white

  2. #2
    Join Date
    Feb 2008
    Posts
    7
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: QOpenOCCI Oracle SQL Plugin

    Yes I am really interested by this project

  3. #3
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Good to hear. Anyone wishing to contact me directly about this project, can use the contact info at https://sourceforge.net/users/a_white/ or the mailing lists listed on the Sourceforge project page.

    Right now I just need people trying it out and finding any missing key features. Though developers are always welcomed

  4. #4
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    I am curious as to how you see your project fitting in.

    Oracle offers the freely available InstantClient for both Linux and XP and it works against their commercial database and their free "Express Edition".

    Are you adding features that InstantClient doesn't have?

  5. #5
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Sorry for the delay in posting, work has been crazy.

    This project is intended to act like any other SQL plug-in for Qt, that it should provide a Qt standard interface to Oracle's DB. I actually use the Instant Client libraries to build this interface.

    The motivation for this project is the lack of a free plug-in for Qt. Trolltech offers similar functionality in their Enterprise Edition, but I see no reason why the Free/Open editions can't have the same tools.

  6. #6
    Join Date
    Nov 2007
    Posts
    5
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Hello!

    I have a problem with QOpenOCCI Oracle SQL Plugin.

    I built plugin on my PowerBook G4 under Mac OS X Tiger 10.4.11 with Qt 4.4.1 Open Source and Oracle Instant Client 10.1. Then I put libqopenocci.dylib into Qt plugin directory.

    Using the plugin I'm trying to connect to the Oracle database from the application:

    QSqlDatabase db = QSqlDatabase::addDatabase("QOpenOCCI");
    db.setHostName( "XXXXXXX" );
    db.setDatabaseName( "XXXXXXX" );
    db.setPort( 1521 );
    db.setUserName( "XXXXXXX" );
    db.setPassword( "XXXXXXX" );
    db.open();

    Debugger gives me an error:

    terminate called after throwing an instance of '
    QOpenOCCIException'
    what(): Error QOpenOCCIDriver.cpp[35]: Error: failed to initialize OCI Environment

    Help me please!

  7. #7
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    The offending code is the following...

    Qt Code:
    1. QOpenOCCIDriver::QOpenOCCIDriver() :
    2. mConnection(NULL)
    3. {
    4. if (QOpenOCCIDriver::driverCount == 0) {
    5. if (!OCI_Initialize(QOpenOCCIDriver::ErrHandle, NULL, OCI_ENV_DEFAULT))
    6. throw QOPEN_OCCI_EXCEPTION("Error: failed to initialize OCI Environment");
    7. }
    8. QOpenOCCIDriver::driverCount++;
    9. }
    To copy to clipboard, switch view to plain text mode 

    Specifically, the OCI_Initialize function is dieing which is actually part of the OCILIB project http://orclib.sourceforge.net/. QOpenOCCI doesn't actually use OCCI anymore due to limitation in Oracle's implementation so it now uses a C OCI wrapper which is OCILIB.

    If I had to guess, the C OCI libraries where not linked at compile time and OCILIB is looking for them and failing. In sort, make sure the Oracle OCI libs are accessible at runtime by copying them to a system wide directory or setting an environment var and see if that fixes your problem.

    QOpenOCCI does have forums and mailing lists for just these types of question though at https://sourceforge.net/projects/qopenocci/

  8. #8
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Re: QOpenOCCI Oracle SQL Plugin

    hi,
    a_white help me...
    plugin version - COpenOCCI 1.3.1a
    OS - WinWP
    QT 4.4.3 opensource with MinGw 5.1.4
    Oracle - 10g

    connection to Oracle and query executing work fine. but I can't call a procedure.

    example:
    Qt Code:
    1. QSqlQuery procedure(DB);
    2. procedure.prepare("call shemename.packagename.procedurename(?,?)");
    3. procedure.bindValue("parameter1", "parameter2");
    4. if (!procedure.exec())
    5. QMessageBox::information(this,tr("error"),tr("%1").arg(procedure.lastError().databaseText()));
    To copy to clipboard, switch view to plain text mode 
    I got error:
    Error QOpenOCCIDriver.cpp[48]: (00911) ORA-00911: invalid character

    What I done wrong?
    Does QOpenOCCI plugin support procedure's executing???

  9. #9
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Look in src/tests for exactly how this is tested. Basically, your code should look like this...

    Qt Code:
    1. QSqlQuery procedure(db);
    2. procedure.prepare( "BEGIN proc_name(:0, :1); END;");
    3. procedure.bindValue(0, x);
    4. procedure.bindValue(1, y);
    5. if (procedure.exec() == FALSE)
    6. QMessageBox::information(this,tr("error"),tr("%1").arg(procedure.lastError().databaseText()));
    To copy to clipboard, switch view to plain text mode 

  10. The following user says thank you to a_white for this useful post:

    deivisj (16th October 2008)

  11. #10
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    thanks a_white.
    My mistake .
    The main error was with bindValue. Your example and QT example how to call procedure works fine. This example correct to...

    Qt Code:
    1. QSqlQuery procedure(DB);
    2. procedure.prepare("call shemename.packagename.procedurename(:0,:1)");
    3. procedure.bindValue(0, "parameter1");
    4. procedure.bindValue(1, "parameter2");
    5. if (!procedure.exec())
    6. QMessageBox::information(this,tr("error"),tr("%1").arg(procedure.lastError().databaseText()));
    To copy to clipboard, switch view to plain text mode 

  12. #11
    Join Date
    Oct 2008
    Posts
    3
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    hi, I have question. how to commit DB correctly?
    do I have to do a query not active for commit? commit work without
    Qt Code:
    1. query->finish();
    To copy to clipboard, switch view to plain text mode 
    but witch way is more correct.

    thanks
    Last edited by deivisj; 29th October 2008 at 10:53.

  13. #12
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Don't know how I missed your reply, but qDB->commit() is the best way to commit a transaction.

    As an added advertisement, QOpenOCCI 2.0 will be released soon and will have many improvements
    Last edited by a_white; 14th November 2008 at 22:16. Reason: spelling error

  14. The following user says thank you to a_white for this useful post:

    deivisj (25th November 2008)

  15. #13
    Join Date
    Dec 2008
    Location
    Lithuania
    Posts
    10
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Hi,
    good thing this plug-in and I'm waiting for QOpenOCCI 2.0 release.

    And want to ask one question.
    In "QSqlQuery Class Reference" says that "Stored procedures that uses the return statement to return values, or return multiple result sets, are not fully supported."

    Does QOpenOCCI 1.3.1.a support values return???


    thanks.
    Last edited by foggy-mind; 22nd December 2008 at 13:08.

  16. #14
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    First, QOpenOCCI is limited to what the OCI and Qt lib support. Saying that, I think you can do what you ask. Second, in the Oracle world, stored procedures never return values and functions always returns values. Small correction but people get them easily confused and we can end up talking about the wrong thing. Now to do what you want you have two cases

    1) See the stored procedure example I posted earlier in this thread. This deals with non-returning calls (unless you do out binds which is allowed too)

    2) Formulate your sql to like "select function_to_call(value) from dual" and then treat that as a normal sql call.

    QOpenOCCI 2.0 should be out soon (yeah I know I said that a while ago) but I am waiting for OCILIB to lock in it's release. I need to make sure that two libs get along before making 2.0 official. If anyone is interested in a pre-release that can contact via souceforge and I will work something out.

  17. The following user says thank you to a_white for this useful post:

    foggy-mind (23rd December 2008)

  18. #15
    Join Date
    Feb 2008
    Posts
    8
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Let me clarify something. QOpenOCCI does not support the Oracle "returning into" clause since the Qt lib does not have a good mechanism for that exchange. May be something for a future release though.

    Next, array like structures are not currently supported in 1.x but will have basic support in 2.0. This will be limited to input bound variables or native non-complex types such as numbers and strings. I am currently investigating a way to tie in non-primitive Oracle types (varrays/nested-tables/objects) back though Qt.

  19. The following user says thank you to a_white for this useful post:

    foggy-mind (23rd December 2008)

  20. #16
    Join Date
    Dec 2008
    Location
    Lithuania
    Posts
    10
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Ye, you are right. there is function. Sorry for stupid question.

  21. #17
    Join Date
    Dec 2008
    Location
    Lithuania
    Posts
    10
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Hy a_white,
    One more question. Does QOpenOCCI plug'in support row count??? By QT documentation it returns with function query->size(), I get -1.

    the size is not supported on driver.
    qDB.driver()->hasFeature(QSqlDriver::QuerySize); returns 0.

    I don't want to use while(query->next()) tmp++; to get row count.
    QSQlQueryModel returns not the right count, and I don't know why (
    Qt Code:
    1. Model = new QModel(this);
    2. Model->setQuery(query);
    3. tmp = Model->rowCount();
    To copy to clipboard, switch view to plain text mode 
    )

    tmp = 255 in fact rows is 419

    Any suggestions...
    thanks.
    Last edited by foggy-mind; 12th March 2009 at 09:16.

  22. #18
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    btw, Qt 4.5.0 opensource already contains OCI driver.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  23. #19
    Join Date
    Dec 2008
    Location
    Lithuania
    Posts
    10
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    Quote Originally Posted by spirit View Post
    btw, Qt 4.5.0 opensource already contains OCI driver.
    very good news

  24. #20
    Join Date
    Dec 2008
    Location
    Lithuania
    Posts
    10
    Thanks
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QOpenOCCI Oracle SQL Plugin

    I find the answer why QSqlQueryModel function count() returns not the real count of rows. The answer is there QSqlQueryModel::fetchMore()

    And QOCI plugin don't report back the size of a query too .

Similar Threads

  1. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 15:13

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.