DB2 SQLJ - Questions on scrollable cursor - db2

We have CICS app talk to DB2 on z/os. We were asked to mimic queries call to DB2 from JDBC using SQLJ as CICS uses static sqls. We are able to successfully do selects and cursors with DB2.
Question:
1. Select statements: CICS issue fetch message to DB2 but JDBC on a resultset on Block fetch in buffer. Is there any way we can avoid this with JDBC? We would like to mimic same fetch message to DB2 as like CICS.

Related

What is the PostgreSQL equivalent of `allowMultiQueries=true`?

I want to execute multiple select statements in the same JDBC query, in order to amortize network latency over a number of related queries, as described in this question:
Multiple queries executed in java in single statement
The accepted answer is to use allowMultiQueries=true. Unfortunately, this is a feature specific to the MySQL JDBC driver.
What is the equivalent in PostgreSQL JDBC?

how can we query data in postgres and oracle in scala jdbc using single getconnection?

I'm trying to query on tables which are in oracle and postgres. here I have used two getconnection methods but while I'm trying to do some join operations it is giving me an error. This error is because of using or querying on a single resultset which has particular(either postgres or oracle) database connection. can we pass two database connections in a single getConnection() method?
note :- Written in scala
JDBC essentially works by sending a query to a database server and presenting the response of the server as a ResultSet to the developer. In other words it does not execute the query but hands it off the database which executes it. Hence JDBC can not magically execute a single query that combines tables from different database servers.
Some databases support linking multiple servers together. In that case you would have to configure the databases to know about each other, and then connect to one of them and send it a query that references the linked server in the correct format (which is different for every vendor). However not all vendors support linked servers, and even less support linking to servers of other vendors.
Another option is using something like spark which has its own query engine. Spark can use JDBC to download the data from both servers to your machine or spark cluster and then execute the query locally.

Moving database from iSeries to DB2 LUW

I have to move a database from DB2 for iSeries V7R2 to DB2 LUW 10.5. As far as I understand, utilities such as db2move and db2look aren't available on iSeries. So what is the best technique to achieve the goal?
If you are able to connect to the iSeries database from a LUW machine (via DCS gateway/DB2 Connect feature) you could run the db2look from the LUW side.
Beware if you run the db2look on the LUW side it still gives you DDL with all the iSeries parameters. This means e.g. if a char column on iSeries could be 255 long (as on z/OS, I don't know the specs for iSeries) the db2look will still give you a create statement for that column with 255 byte although DB2 LUW only supports 254 byte CHAR columns.
Like with the db2look via "gateway" you could declare cursors on the iSeries the same way and then load directly into the target database. You may need to convert the restrictions (like mentioned above) already in the SQL Statement for the reading cursor.
Good part on the cursor approach is that due to the point that both DB2 sides are talking directly with another there is an implicit codepage conversation which you would need to manage yourself if you try to extract the data from iSeries and reload it into LUW.

DB2 Where are profile tool like SQL Server Profiler?

I'm using DB2 9.5. Is there exists tool like SQL Server Profiler?
I want to view all executing SQL queries.
To watch all executed queries you can create an event monitor. Please see CREATE EVENT MONITOR statement for statements.
Finally have found a nice small and light-weight and freeware tool: db2mon.
http://www.db2mon.com/

How to transfer or copy tables of DB2 to oracle database

I want to transfer some tables of DB2 to oracle daily for accessing them from web page,
But I don't know commands of DB2. How to do this?
I want this action should perform on database daily on particular time, so is there any tool is available to do this operation. And for writing the program for operating above query which programming language should I use? I am using windows XP.
I think Change Data Capture is used to replicate DML from one database to other databases continuously.
However, what you need is to transfer some data at a particular time each day, thus CDC could be too heavy for that.
You could do a simply "db2 export", and then you could import the generated file from Oracle.
There should be an option to create an adapter in Oracle that permits to query DB2 tables. The opposite is called federation in DB2 (InfoSphere Information Server) that permits to query Oracle tables.
Export http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0008303.html
CMD examples http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.admin.dm.doc/doc/r0004567.html
Check this link
http://blogs.oracle.com/warehousebuilder/entry/simple_change_data_capture_from_db2_table_to_oracle_table
In 11.2 releases, Change Data Capture (CDC) can be done by code template mapping. This allows users to capture the data changes from heterogeneous data source, and load into the target across different platforms.