Accessing data sources using pass-through sessions

You can submit SQL statements directly to data sources by using a special mode that is called pass-through. The pass-through session allows you to submit SQL statements in the SQL dialect for that data source.

Use a pass-through session when you want to perform an operation that is impossible with the SQL. For example, use a pass-through session to create a procedure, create an index, or perform queries in the native dialect of the data source.

The data sources that support pass-through only accept SQL statements in a pass-through session.

Similarly, you can use a pass-through session to perform actions that are not supported by SQL, such as certain administrative tasks. The administrative tasks that you can perform depend on the data source. For example, for Db2®, you can run the statistics utility for the data source, but you cannot start or stop the remote database.

You can query only one data source at a time in a pass-through session. Use the SET PASSTHRU command to open a session. When you use the SET PASSTHRU RESET command it closes the pass-through session. If you use the SET PASSTHRU command instead of the SET PASSTHRU RESET command, the current pass-through session is closed and a new pass-through session is opened.

You can declare a cursor WITH HOLD in a pass-through session. If you use this option with the DRDA wrapper and the Db2 data source, the cursors that you declare remain open across multiple units of work. If you declare a cursor WITH HOLD and the data source does not support this option, the attribute is ignored.

You cannot use pass-through sessions with nonrelational data sources.