db2

ODBC Connection to DB2 Hangs

I have a function I use to send write queries to DB2 through ODBC, and it gets hung up in this function from time to time if I lose my connection to DB2. I am sending 60 as my timeout to the function, but it never times out. It just hangs up my thread indefinitely, and I'm not sure of a good way to force this function to give up. public...

db2 special character 0x1A

Hi, how can I seach for a spezial character like "→" (0x1A). An example for my query is: select * from Data where Name like '%→%' I want to use instead of "→" somethoing like 0x1A I can't use any Java or C# Code. I just have SQuirrel to connect and send commands to the database. Thanks Stefan ...

FULL OUTER JOIN or UNION ?

Hi, confused how to achieve this maybe with FULL OUTER or a UNION. I want to join results in such a way that Table1 Table2 --------------- ----------------- ID Name Salary ID Fruits --------------- ----------------- 1 John 1000 1 Apples 1 Henry 4000 ...

Connect to IBM DB2 with .Net using only .dll reference

I would like to connect to a DB2 database, specifically an iSeries version, using .Net and C# by referencing a .dll and NOT installing any software on the server. Currently we use the IBM.Data.DB2.iSeries.dll, which is installed as part of iSeries access for windows. I don't want to have to install all of that. But apparently I don't hav...

Updating a db table based on 2 separate conditions

I need to update my table (dependency) and set a new column (vid) to the nextval of a sequence. I can't change the way data is in the table so please don't mention removing redundant data. However, the where condition is the issue as 2 conditions need to be met (the cols provid and origid). There is a separate primary key (prikey). The ...

Use of CASE statement values in THEN expression

I am attempting to use a case statement but keep getting errors. Here's the statement: select TABLE1.acct, CASE WHEN TABLE1.acct_id in (select acct_id from TABLE2 group by acct_id having count(*) = 1 ) THEN ...

How can we View the DB2 Procedure and How can we execute the DB2 Procedure and just see the output of the procedure using DB2

How can we View the DB2 Procedure (I mean what logic they have written ) and How can we execute the DB2 Procedure and just see the output of the procedure using DB2 ...

how to form a tree structure from DB2 Table(s)?

Please refer to this question database-structure-for-tree-data-structure Is this possible in DB2 Database? I know it is possible in Oracle using START WITH and CONNECT BY, i don't have any idea in DB2, Is it possible to achieve this in DB2? Thanks! ...

What is the use of reorg command in IBM DB2 ?

What is the use of reorg command in ibm db2 db ? What does Reorg do internally ? Is it necessary to run reorg if new indexes are created on the table ? ...

Performance Problems - Large DLLs and Large Namespaces

This is sort of the next step of the LINQ to DB2 question I asked here. Following zb_z's answer, I poked around a bit with the code for DB_Linq and have managed to add working DB2 support. (It's still in its infancy now, not ready to be contributed back to the project yet.) The proof of concept worked great, it was pretty exciting act...

Perl prepare DB2 statement not returning what I need

Hey, Since I am using DB2, in order to select a portion of a database in the middle (like a limit/offset pairing), I need to do a different kind of prepare statement. The example I was given was this: SELECT * FROM (SELECT col1, col2, col3, ROW_NUMBER() OVER () AS RN FROM table) AS cols WHERE RN BETWEEN 1 AND 10000; Which I adapted ...

COBOL DB2 program

Hi, If I have 1 COBOL DB2 program which is calling 2 other COBOL DB2 sub programs, then how many DBRMs,Packages,Plans it will create? If I am changing any one of the sub program then do I need to recompile and bind all the programs?I am really confused with DBRMs,Plans and Packages. Regards, Manasi ...

Linked Server Dangers

Is there any danger is creating a linked server? I want to create linked server to a DB2 database from SQL Server 2005. Will the DB2 database be effected by this at all (performance wise) or is this all handled on the SQL Server side? ...

Migrating a stored procedure using REF CURSOR from Oracle to DB2

I'm currently migrating a package of procedures from Oracle to DB2, with the assistance of the IBM Migration Toolkit. MTK unfortunately chokes on custom types, such as: TYPE G_reference_cursor IS REF_CURSOR ... FUNCTION do_some_stuff RETURN g_reference_cursor ... What would be the idiomatic way of migrating these statements to DB2?...

valgrind with ODBC Driver for DB2 gives error

I'm using the Valgrind's massif tool to measure the heap allocation of my application. with the valgrind, the application fails to connect to the DB2 with the below error: SQL1366N A security plug-in "IBMOSauthclient" processing error occurred on the client. Reason code = "7". Without the valgrind the application runs fine with connec...

SQL Union/Join Query

I have a user profile table with columns User Name, manager and many other fields, for example amount.. Example Records:- User Manager Amount A B 100 x y 200 B C 300 M N 800 C D 500 P Q 1000 D E 1000 I am trying to get the result as below:- User...

how to update multiple rows with the same sequnce value

I'm using DB2 and want to update several rows that meet my condition with the same next value from my sequence. Here is what I tried but this doesn't work as the next value is fetched for each row:- update dependency dep set vid=NEXT VALUE FOR seq_VID where id in ('8371','8372','8373') id is the the primary key and seq_VID is a sequen...

implementing paging logic in DB2 SQL

Hi, Is there a way to implement paging logic in DB2 SQL, where records can be fetched page wise. The following query works only for queries with no joins. When queries with join are used the ROW_NUM is returned as 0 and paging cannot be done. SELECT * FROM (SELECT ROWNUMBER() OVER() AS ROW_NUM, Results.* FROM (S...

SQL0104N An unexpected token "?" was found with DB2 and SharePoint BCS

We are using SharePoint BCS to connect to our DB2 Database, we have our method configured as the following <Property Name="RdbCommandText" Type="System.String">select "EMPNO","FIRSTNME","MIDINIT","LASTNAME" from ADMINISTRATOR."EMPLOYEE" order by "FIRSTNME" fetch first ? rows only</Property> we also have a limit Filter which provides t...

Retrieving a max date from DB2 in Java throwing wrong column type conversion exception

I have the following SQL that returns the max BILL_DATE based on some criteria. BILL_DATE is defined in the database as a DATE. SELECT MAX(BILL_DATE) FROM BILLTABLE WHERE col1 = ? and col2 = ? But when I read the value from the resultSet. bill.setBillDate(resultSet.getDate(1)); An exception is thrown: Invalid data conversion...