db2

Split a VARCHAR in DB2 to retrieve a value inside

I have a VARCHAR column that contains 5 informations (2 CHAR(3) and 3 TIMESTAMP) separated with '$'. CREATE TABLE MYTABLE ( COL VARCHAR(256) NOT NULL ); INSERT INTO MYTABLE VALUES ( 'AAA$000$2009-10-10 10:50:00$null$null$null' ), ( 'AAB$020$2007-04-10 10:50:00$null$null$null' ), ( 'AAC$780$null$2007-04-10 10:50:00$2009-...

DB2 performance analysis tools for developers

As a developer using DB2 for the first time, I'm not familiar with what the best database performance analysis tools are for it. I'm wondering what others have found useful in terms of tools that come with DB2, and any third-party tools available for it. e.g. Anything better than others for things like query planning, CPU measureme...

DB2 error code -670 when adding a new column programmatically

I'm developing against a DB2 database, and at some point I get an error code "-670" when trying to add a new column. The error code indicates an insufficiently sized tablespace page size, anyway, I just went and ran a DESCRIBE command and I estimate I don't have more than 17K for the table width (I just added the numeric value contained...

link with DB2 ODBC drivers on Linux

Hi All, I need to link our C/C++ code that is using the DB2 ODBC driver on linux, and although ive pulled in sqlcli.h I dont know where to find the objects so i can link. Ive installed DB2 v9.1 ESE so i wouldve thought i could get everything. Anybody got any ideas? ...

Java - retrieving large amounts of data from a DB using iBatis

I need to extract data from a DB2 table, run some processing on each returned row and output to a flat file. I'm using iBatis but found that using the queryForList I started getting out of memory errors, I'll be looking at 100k+ rows of data increasing. I've looked at using queryWithRowHandler instead but the iBatis RowHandler interfac...

DB2 Increment a value by a certain amount

I need to write a query that increments a value in a table by 3 when run. I would like to do something like this but this doesn't work. UPDATE table SET value = (SELECT value FROM table WHERE condition = true) + 3 WHERE condition = true As in the title this is a DB2 database, any ideas? EDIT: Actually this d...

DB2 vs PostgreSQL vs SQL Server

Has anyone used all three of these databases? What are you experiences with them? PostgreSQL is starting to look pretty tempting to use for a project but I'm curious to learn more about it (We're a .NET Shop). I've also heard quite a lot of people being satisfied with DB2. ...

Simplest way to access a DB2 database on iSeries from a Linux (ubuntu) machine?

I would like to run an SQL query on an iSeries (...or "System i" or "AS/400"...) machine as part of a Nagios check, but haven't found a suitable way of interfacing the database yet. IBM suggests using the ODBC driver of System i Access for Linux with unixODBC, but since both systems are new to me, I'd like to know if there are other wa...

Performance of SQL ORDER BY clause with VarChar Strings

I'm looking to do a SELECT with an ORDER BY on a VARCHAR(200) field. Reading the DB2 v9.1 for zOS site on this it says Ordering is performed in accordance with the comparison rules described in Language elements. And in the rules for Character string comparisons says Two strings are compared by comparing the corresponding...

Unable to send .NET transaction to DB2 server in window 2003

Hello, I am working on a project which need to use .NET Transaction with DB2 server on window server 2003. The point is when I tried to send the transaction from Vista platform to DB2 server, it show some error like this: SQL0998N Error occurred during transaction or heuristic processing. Reason Code = "16". Subcode = "2-80004005" ...

Problems using REXX to access both Teradata output and DB2 output

I have a REXX job that needs to read from both Teradata (using BTEQ) and DB2. At present, I can get it to either read from Teradata or DB2, but not both. When I try to read from both, the Teradata one (which runs first) works fine but the DB2 read gives an error of RC(1) upon attempting to open the cursor. Code to read from Teradata (by...

TransactionScope won't work with DB2 provider

Hi Everyone, I've been trying to use TransactionScope with a DB2 database (using DB2 .Net provider v 9.0.0.2 and c# 2.0) which SHOULD be supported according to IBM. I have tried all the advice i could find on the IBM forums (such as here) to no avail. I have enabled XA transactions on my XP Sp2 machine, tried also from a Win 2003 Serv...

DB2 SQL add rows based on other rows.

Hi All, I have a select statement that I want to use as the basis for adding more rows to a table. The new rows will have some columns modified and the original row will have to be altered also. This is a once off occurance and the DB can be taken offline if that helps. Any ideas? Thanks, Joe ================= Description Update M...

DB2 Runtime Error

UPDATE S SET (S.a, S.b, S.c) = ( SELECT FS.a, FS.b, FS.c FROM (SELECT T.a, T.b, T.c, T.d, T.e, CASE WHEN IS.a IS NULL THEN 'N' ELSE 'Y' END FROM t T JOIN y ON(y.a = T.a) ) FS WHERE FS.a = S.e...

How to set DB2 ODBC driver locale?

I want to import data from a DB2 database into MS Access via ODBC. The connection is set up and working but decimal values get converted due to some locale issue (German Windows). 234.75 ends up as 23475 in the Access table. I had the same issue with Oracle but was able to fix it by setting the ODBC drive to US locale. How can I do tha...

Setting DB2 Client Audit information with a dbcp connection pool in a Java app

I'm developing Java apps on Tomcat 5.5 using JNDI to connect to shared dbcp connection pools with JDBC 3.0 drivers and DB2 8 on zOS and also DB2 9 on LUW. In my app, I use org.springframework.jndi.JndiObjectFactoryBean to get the dataSource and feed it into an org.springframework.jdbc.core.simple.SimpleJdbcTemplate to run the queries. ...

How to compile / create the stored procedure in older version of DB2 ?

I am having db2 9.5 whereas our client is having db2 9.1. So what happenes is, if i create a SP which is using any function present in 9.5 but not in 9.1 then the procedure will fail to compile / create on client side. Is it possible to compile the SP as it will be in 9.1 ? ...

DB2 - Ranking data by timeframe

I am trying to write a report (DB2 9.5 on Solaris) to do the following: I have a set of data, let's say it's an order table. I want to run a report which will give me, for each month, the number of orders per customer, and their "rank" that month. The rank would be based on the number of orders. I was playing around with the RANK() OVER...

Hitting some limit under z/OS with DB2 Connect JDBC t4 driver.

We have an application connecting to DB2 under z/OS and, after a while, there seems to be some resource limit being hit on the mainframe side. Since we're using BIRT, it seems the only control we have over the JDBC code is with stanzas in the URL itself. we don't have direct Java control over the connection or statements (except for the ...

how to create static cursor in db2?

I am facing a problem while creating a static cursor in DB2. This is the statement i used in my SP. DECLARE CURNAME SENSITIVE STATIC SCROLL CURSOR FOR SELECT COL1, COL2 FROM SCH.TABLENA ORDER BY COL1; on compilation it says : DB2 Database Error: ERROR [42601] [IBM][DB2/NT] SQL0104N An unexpected token "SEN...