win7+qt5.2.0 connection oracle11g problem and its solving method

Source: Internet
Author: User

After establishing the connection with the following code, there are a few problems

[HTML]View Plaincopy
  1. Connecting to a database
  2. Qsqldatabase db = qsqldatabase:: Adddatabase ("Qoci");
  3. /** Connecting the Oracle Database
  4. * Database name: ABC
  5. * Table Name: my_oracle
  6. * User name: sys
  7. * Password: 123
  8. * Port number: (default) 1521
  9. */
  10. Db.setport (1521);
  11. Db.sethostname ("localhost");
  12. Db.setdatabasename ("abc");
  13. Db.setusername ("sys");
  14. Db.setpassword ("123");
  15. if (!db.open ())
  16. {
  17. Link database failed ";
  18. Db.lasterror (). text ();
  19. return false;
  20. }
When you export the contents of Db.lasterror (). Text () to a label, the following questions appear:
1. Prompt: Driver not loaded
Workaround: Copy the folder sqldrivers under the Qt installation directory C:\Qt\Qt5.2.0\5.2.0\Src\qtbase\plugins to your own project file build-linkoracle-desktop_qt_5_2_0_ Mingw_32bit-debug\ theDebug directory.
There are four files in the folder sqldrivers: Libqsqloci.a, LIBQSQLOCID.A, Qsqloci.dll,qsqlocid.dll
2. Prompt: ORA-28009: Should establish the SYS connection unable to logon as SYSDBA identity or sysoper identity
Workaround: Create a new user, connect with the new user, and connect successfully.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.