Qt-sql driver for oracle




















Note that the driver only supports the UTF-8 encoding. If your database uses any other encoding, the server must be compiled with Unicode conversion support. Unicode support was introduced in PostgreSQL version 7. PostgreSQL databases will only respect case sensitivity if the table or field name is quoted when the table is created.

So for example, a SQL query such as:. If the table or field name is not quoted when created, the actual table name or field name will be lower-case. When QSqlDatabase::record or QSqlDatabase::primaryIndex access a table or field that was unquoted when created, the name passed to the function must be lower-case to ensure it is found. For example:. If the plugin is built with an older version, then forward-only mode will not be available - calling QSqlQuery::setForwardOnly with true will have no effect.

While navigating the results in forward-only mode, the handle of QSqlResult may change. Applications that use the low-level handle of SQL result must get a new handle after each call to any of QSqlResult fetch functions.

While reading the results of a forward-only query with PostgreSQL, the database connection cannot be used to execute other queries.

This is a limitation of libpq library. This problem will not occur if query1 and query2 use different database connections, or if we execute query2 after the while loop. Note: Some methods of QSqlDatabase like tables , primaryIndex implicitly execute SQL queries, so these also cannot be used while navigating the results of forward-only query.

Install the appropriate PostgreSQL developer libraries for your compiler. When you distribute your application, remember to include libpq. The DB2 header and include files should already be installed in the right directories.

SQLite is an in-process database, which means that it is not necessary to have a database server. SQLite operates on a single file, which must be set as the database name when opening a connection. If the file does not exist, SQLite will try to create it.

SQLite also supports in-memory and temporary databases. Simply pass respectively ":memory:" or an empty string as the database name. SQLite has some restrictions regarding multiple users and multiple transactions.

This is due to SQLite associating the type of a value with the value itself rather than with the column it is stored in. A consequence of this is that the type returned by QSqlField::type only indicates the field's recommended type.

No assumption of the actual type should be made from this and the type of the individual values should be checked. The driver is locked for updates while a select is executed.

SQLite version 3 is included as a third-party library within Qt. This is recommended whenever possible, as it reduces the installation size and removes one component for which you need to track security advisories. However the needed implementation must be provided by the user. For better performance the regular expressions are cached internally.

By default the cache size is 25, but it can be changed through the option's value. SQLite minor releases sometimes break file format forward compatibility. For example, SQLite 3. Please refer to the SQLite documentation and change logs for information about file format compatibility between versions. Patch releases are therefore both backward and forward compatible. To force SQLite to use a specific file format, it is necessary to build and ship your own database plugin with your own SQLite library as illustrated above.

On Unix and Mac OS X, the Qt configure script tries to automatically detect the available client libraries on your machine. Run configure -help to see what drivers can be built. You should get an output similar to this:. The configure script cannot detect the neccessary libraries and include files if they are not in the standard paths, so it may be necessary to specify these paths using the -I and -L command-line options.

On Windows the -I parameter doesn't accept spaces in filenames, so use the 8. Look at the sections that follow for additional information about required libraries. Note: outval1 and outval2 are variables local to the current connection and will not be affected by queries sent from another host or connection. The MySQL embedded server is a drop-in replacement for the normal client library. You need the MySQL header files and as well as the shared library libmysqlclient. Depending on your Linux distribution you may need to install a package which is usually called "mysql-devel".

After installing Qt, as described in the Installing Qt for X11 Platforms document, you also need to install the plugin in the standard location:. You need to get the MySQL installation files.

EXE and choose "Custom Install". If you are not using a Microsoft compiler, replace nmake with make in the line above. Note: Including "-o Makefile" as an argument to qmake to tell it where to build the makefile can cause the plugin to be built in release mode only. If you are expecting a debug version to be built as well, don't use the "-o Makefile" option. In this example, Qt 4. After connecting to the Oracle server, the plugin will auto-detect the database version and enable features accordingly.

It's possible to connect to a Oracle database without a tnsnames. This requires that the database SID is passed to the driver as the database name and that a hostname is given. Usually, this means that the database server will use the user authentication provided by the operating system instead of its own authentication mechanism.

Leave the username and password empty when opening a connection with QSqlDatabase to use the external credentials authentication. Here is an example:. When you run your application you will also need to add the oci. ODBC support can be used as a fallback for compliant databases if no native drivers are available. For Unix systems there are some implementations which must be installed first. Some ODBC drivers claim to be version 2.

The QODBC plugin therefore checks whether the data source can be used after a connection has been established and refuses to work if the check fails.

Do this at your own risk! To avoid this problem, instruct the ODBC driver to behave as a 3. Note that this will affect multiple aspects of ODBC driver behavior, e. Before setting this connect option, consult your ODBC documentation about behavior differences you can expect. Some drivers don't support scrollable cursors. In that case case only queries in forwardOnly mode can be used successfully.

With Microsoft SQL Server the result set returned by a stored procedure that uses the return statement, or returns multiple result sets, will be accessible only if you set the query's forward only mode to forward using QSqlQuery::setForwardOnly. On Windows NT based systems, this is the default. It is recommended that you use unixODBC.

You need the unixODBC header files and shared libraries. It is recommended that you use unixODBC. You need the unixODBC header files and shared libraries.

The ODBC header and include files should already be installed in the right directories. You just have to build the plugin as follows:. We recommend that you use a client library from version 7. Unicode is automatically used if the server supports it.

Note that the driver only supports the UTF-8 encoding. If your database uses any other encoding, the server must be compiled with Unicode conversion support.

Unicode support was introduced in PostgreSQL version 7. Install the appropriate PostgreSQL developer libraries for your compiler. QTDS is obsolete from Qt 4. It is not possible to set the port with QSqlDatabase::setPort due to limitations in the Sybase client library.

Refer to the Sybase documentation for information on how to set up a Sybase client configuration file to enable connections to databases on non-default ports.

Regardless of which library you use, the shared object file libsybdb. Set the SYBASE environment variable to point to the directory where you installed the client library and execute qmake :.

LIB to build the plugin:. The DB2 header and include files should already be installed in the right directories. The Qt SQLite 2 plugin is offered for compatibility. Whenever possible, use the version 3 plugin instead. The build instructions for version 3 apply to version 2 as well. SQLite is an in-process database, which means that it is not necessary to have a database server. SQLite operates on a single file, which must be set as the database name when opening a connection.

If the file does not exist, SQLite will try to create it. SQLite also supports in-memory databases, simply pass ":memory:" as the database name. SQLite has some restrictions regarding multiple users and multiple transactions.

This is due to SQLite associating the type of a value with the value itself rather than with the column it is stored in. A consequence of this is that the type returned by QSqlField::type only indicates the field's recommended type. No assumption of the actual type should be made from this and the type of the individual values should be checked.

The driver is locked for updates while a select is executed. SQLite version 3 is included as a third-party library within Qt. It can be built by passing the following parameters to the configure script: -plugin-sql-sqlite build as a plugin or -qt-sql-sqlite linked directly into the Qt library.

SQLite minor releases sometimes break file format forward compatibility. For example, SQLite 3. Please refer to the SQLite documentation and change logs for information about file format compatibility between versions. Patch releases are therefore both backward and forward compatible. To force SQLite to use a specific file format, it is neccessary to build and ship your own database plugin with your own SQLite library as illustrated above.

The database file must exist before a connection can be established. Firebird must be used with a server configuration.

Note that InterBase requires you to specify the full path to the database file, no matter whether it is stored locally or on another server. Please use Firebird or the free edition of InterBase. Note that if the text encoding set when connecting to the database is not the same as in the database, problems with transliteration might arise. You should always use client libraries that have been compiled with the same compiler as you are using for your project.



0コメント

  • 1000 / 1000