Results 1 to 11 of 11

Thread: Windows OCI QSqlDatabase connection

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Location
    New Orleans
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Windows OCI QSqlDatabase connection

    Hey ya'll! I'm new and in need of guidance. I cannot seem to find help throught the forum on the error I keep getting. I just want to connect to my database. I'm using windows xp professional operating system btw.

    So here is my code in main.cpp for connecting to the database with a little popup that will tell me if the connection works. And I've attached the qsql_oci.h and qsql_oci.cpp files.

    Qt Code:
    1. #include <QtGui/QApplication>
    2. #include <QtSql>
    3. #include <QDebug>
    4. #include <QSqlDatabase>
    5. #include "iostream"
    6. #include "qsql_oci.h"
    7. #include "qsql_oci.cpp"
    8.  
    9. int main(int argc, char *argv[])
    10. {
    11.  
    12. QApplication a(argc, argv);
    13.  
    14. QSqlDatabase db = QSqlDatabase::addDatabase("OCI");
    15.  
    16. db.setHostName("datawarehouse");
    17. db.setDatabaseName("mydatabase");
    18. db.setUserName("hollyberry");
    19. db.setPassword("password");
    20.  
    21.  
    22. if(db.open())
    23. {
    24. qDebug() << "Opened!";
    25. db.close();
    26. }
    27. else
    28. {
    29. qDebug() << "Error = " << db.lastError().text();
    30. }
    31.  
    32.  
    33. return a.exec();
    34. }
    To copy to clipboard, switch view to plain text mode 


    The first error I continue to recieve is "OCIStmt was not declared in this scope".
    Followed by "ub1 does not name a type" and many more errors like this! Grrrr....
    Attached Files Attached Files
    Last edited by Lykurg; 6th February 2012 at 19:25. Reason: missing [code] tags

Similar Threads

  1. How to set x509 on a QSqlDatabase Connection?
    By m3rlin in forum Qt Programming
    Replies: 24
    Last Post: 21st February 2012, 04:04
  2. QSqlDatabase Connection Close on Destruction
    By Sanuden in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2011, 15:32
  3. QSqlDatabase connection timeout?
    By joseprl89 in forum Qt Programming
    Replies: 6
    Last Post: 27th March 2011, 01:43
  4. QSqlDatabase PSQL connection options
    By leknarf in forum Qt Programming
    Replies: 0
    Last Post: 17th March 2010, 16:06
  5. Replies: 3
    Last Post: 22nd June 2006, 16:27

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.