db2

concatenating strings from two different rows in a table

Hello, We are attempting to rework the SQL in a product. The product stores XML in a table as follows: XML_STORAGE - UID IDENTITY - PARENT_ID INTEGER - SEQ INTEGER - XML VARCHAR(3800) The current way of doing this is as follows: Retrieve all ROWS for PARENT_ID = n. Then go over the fetched rows in the code and concatenate the X...

How to get variable value from inside a stored procedure in DB2?

This seems like it should be very easy...anyway, it is in MS SQL Server In a DB2 stored procedure, how can I just get the value of a variable? Say I have the following stored procedure: CREATE PROCEDURE etl.TestABC( ) LANGUAGE SQL BEGIN declare Stmt varchar(2048); set Stmt = 'this is a test'; -- print ...

How to pass db2 values to jQuery grid

Hello friend, I have a db2 table with certain columns. I have a stored procedure for select all table Can anybody tell me how to use this stored procedure to fill the json grid. Using asp.net mvc control.. thanks ...

Db2 sql dump tools

I am searching for tools to dump db2 tables (like sqlyog or MySQL browser in MySQL). Can you suggest me some? Thanks ...

DB2: Won't Allow "NULL" column?

Part of a complex query that our app is running contains the lines: ...(inner query) SELECT ... NULL as column_A, NULL as column_B, ... FROM ... This syntax of creating columns with null values is not allowed in DB2 altough it is totally OK in MSSQL and Oracle DBs. Technically I can change it to: '' as column_A, '' as column_B, B...

DB2 SQL count in join or where clause

This is probably an amateur question but I'm an amateur ! ;o) I have several tables: Account table, Officer table, Location table, Web table... The Officer table doesn't give me the number of officers per account. I need to retrieve only the accounts that have more than 20 officers. Should I use the COUNT ? If so, how ? Your help is...

How do I use Criteria to make a join on a date field (in DB2) based on the year.

I have a java.util.Date field in my Object. I would like to use Criteria to select all rows that have a date field with a given year. The SQL would look like the following: SELECT * FROM GAME GM WHERE YEAR(GM.GAME_DATE) = 2010 How can I use Criteria to accomplish this? Thanks in advance. public Collection<Game> getGamesByDate(Date...

Using OLEDB parameters in .NET when connecting to an AS400/DB2

I have been pulling my hair out trying to figure out what I can't get parameters to work in my query. I have the code written in VB.NET trying to do a query to an AS/400. I have IBM Access for Windows installed and I am able to get queries to work, just not with parameters. Any time I include a parameter in my query (ex. @MyParm) it does...

DB2 ODBC driver

I have a VBScript based ASP application that is being migrated from a Windows 2000 server to a Windows 2003 Server. DB2 Connect v8.2 is installed on the Win2K production box, and the application ADO connection string includes this property: "Provider=IBMDADB2". The Win2K3 box has DB2 Connect v9.5, and using the same provider in the ...

How do you insert a line break into a DB2 SQL PL VARCHAR variable?

It seems like this should be tremendously easy, but I've had no luck thus far. ...

ODBC datasource for DB2 on 64 bit Windows 2008

I just finished development of some code that communicates with DB2 and want to test/deploy it on a Windows 2008 machine. I'm a bit concerned about not being able to find a working ODBC datasource (DSN/client) driver for DB2 on Windows 2008 (x64). I have a 32-bit driver for XP but that one (obviously) won't install on 2008-64. The IBM w...

db2 online backup to tape

SAP : ecc 6.0 os : linux 64 db : DB2 Tape : Hp data protector 6.0 Issue : Online backup to tape fails Running : db2 backup db hcp online to /dev/rst0 /dev/rst0==> is a tape volume Trying to take online backup from db2 from command prompt to the tape. hclprdm:~ # su - db2hcp hclprdm:db2hcp 51> db2 backup db hcp online to /dev/rst...

Finding Most Recent Order for a Particular Item

I'm trying to write a SQL Query for DB2 Version 8 which retrieves the most recent order of a specific part for a list of users. The query receives a parameter which contains a list of customerId numbers and the partId number. For example, Order Table OrderID PartID CustomerID OrderTime I initially wanted to try: Select * from Order ...

Problem with DB2 Over clause

I'm trying to do pagination with a very old version of DB2 and the only way I could figure out selecting a range of rows was to use the OVER command. This query provide's the correct results (the results that I want to paginate over). select MIN(REFID) as REFID, REFGROUPID from ARMS_REFERRAL where REFERRAL_ID<>'Draft' and REFERRAL_ID n...

IDataRecord.IsDBNull causes an System.OverflowException (Arithmetic Overflow)

Hi! I have a OdbcDataReader that gets data from a database and returns a set of records. The code that executes the query looks as follows: OdbcDataReader reader = command.ExecuteReader(); while (reader.Read()) { yield return reader.AsMovexProduct(); } The method returns an IEnumerable of a custom type (MovexProduct). The conv...

Auto Reconnect of Database Connection

I have a DBCP connection pool in Tomcat. The problem is that when the connection is lost briefly the appliction is broken because DBCP won't try to reconnect again later when there is a connection. Can I get DBCP to reconnect automatically? ...

SQLCODE -1390 connecting to DB2 64 bit client from 32 bit app

Hi there, I've got a 32 bit application that connects normally to a DB2 database. (written in C) When I run it on a machine with a DB2 64 bit client, I get a SQLCODE -1390 from connect. (Win7 64 Bit, DB2 V9.7 client 64 bit) Connecting from the command line works (db2 connect to ...) With a 32 Bit DB2 client on the same Win7 64 Bit machi...

DB2 Transaction Logs

How to read Transaction Logs of DB2 in iSeries / AS/400. Is there any C or C++ or Java API Any help is appreciated? ...

Unable to allocate new pages in table space "XXXX" ... but it's 250 megs and I'm only running DDL

Hello, I'm a DB2 newbie, so I'd appreciate even any pointers on where to start looking. We have great DB2 admins but they're swamped with other issues now, so I'm trying to do some troubleshooting on a development database. My situation is that I have a tablespace that's giving me this error message Unable to allocate new pages in ta...

deleting a large number of rows from a table

We have a requirement to delete rows in the order of millions from multiple tables as a batch job (note that we are not deleting all the rows, we are deleting based on a timestamp stored in an indexed column). Obviously a normal DELETE takes forever (because of logging, referential constraint checking etc.). I know in the LUW world, we h...