db2

Oracle versus DB2 on data Validation

Most forums cite minor differences in speed, backup, etc. It's about time someone tell how the two differ when it comes to GUI data validation. Do this 2 Database always depend on java(or other software), or do they have the ability to create a user interface the accepts only valid input. Things like: positive numbers only, age between 1...

Bash script - Take system output and use it as a variable

Hi, Pretty simple question, I'm trying to get some output after executing a command and use it again. #!/bin/bash echo what's the source db name? read SOURCE echo what's the target db name? read TARGET db2 backup db $SOURCE online compress include logs READ SOME OF THIS LINE = SOURCE db2 restore database $SOURCE taken at $DB2TIME into ...

bash script - DB2 "db2 restore database" default answer YES

Hi, I'm trying to make a bash script that's going to backup a db2 database and then restore it into a different database. The problem is that DB2 asks a (y/n) question, and I can't get an auto answer for it to work - it needs a y and carriage return. I've tried the following line (and the yes command) tho it doens't work #while true; d...

Sub-query in tuple constraint DB2

Hi, In my database course we use a book (Database System - the Complete Book) which says the following is a valid create table statement in standard SQL: CREATE TABLE Participants ( meetid INT NOT NULL, -- ... CONSTRAINT RoomConstraint CHECK (1 >= ALL (SELECT num FROM Numbers) ); But DB2 complains and gives 20 pos...

Where will the tablespace be stored?

I am creating a table with tablespace: CREATE TABLE SALARY..... IN ACCOUNTING INDEX IN ACCOUNT_IDX Where will the Accounting and Account_IDX be created? ...

How to reset/change expired password for DB2 Content Manager 8.4.1

I had installed IBM DB2 Content Manager 8.4.1 months ago and now I wanted to access it to continue some more work. But when I try to log in using System Administration Client, it tells me the password is expired. The error is: DGL0394A: Error in ::DriverManager.getConnection;[jcc][t4][2012][11248][3.50.152] Connection authorization fai...

DB2 v8 insert with CTE

I need to select from a CTE (common table expression) in DB2 v8 and insert the result into a table. The relevant documentation for v8 is hard to understand at first glance, but for v9 there's a clear example (http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.apsg/db2z_createcte.htm): INSERT INTO vi...

Eliminating Duplicate Records in a DB2 Table

How do delete duplicate records in a DB2 table? I want to be left with a single record for each group of dupes. ...

JavaScript getSelection() in certain pane?

hi, I'm trying to change the code of query-tool "Technology Explorer for IBM DB2", so only selected query will be run... I already got some help from the developer himself,but this only helped me find the right parts of code, not with coding new functionality... http://sourceforge.net/projects/db2mc/forums/forum/761212/topic/3821430 I...

How to find out current transaction log size in DB2?

How to find out the current transaction log size? Is it possible to do e.g. by querying some system tables with SQL? It would also be interesting to find out the maximum size for the transaction log. Is the only option to look it up from the file system? ...

what's the best way to backup a large real-time data warehouse?

I've got a db2 ese 9.7 non-dpf data warehouse using data compression with 20 TB of data that gets 100 million rows a day via loads every 10 minutes and gets another million a day via 50,000 imports every day. Additionally, there is a small amount of transactional data associated with the other two large sets of data. Currently, we're u...

SQLSTATE 24000 - Invalid Cursor State

I connect to a DB2 database and makes the following query. I don't understand why I get the error: "invalid cursor state". public static void blivPar() { try { Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); stmt.setM...

Create a delimitted string from a query in DB2

I am trying to create a delimitted string from the results of a query in DB2 on the iSeries (AS/400). I've done this in T-SQL, but can't find a way to do it here. Here is my code in T-SQL. I'm looking for an equivelant in DB2. DECLARE @a VARCHAR(1000) SELECT @a = COALESCE(@a + ', ' + [Description], [Description]) FROM AP.Checkbooks SEL...

Converting SQL number into a time, to perform date comparisons.

I am struggling with an SQL time comparison on two fields that have been set up as integers, rather than time stamps. I have some performance metrics in a database that the developer originally set up as int(8). The database contains the start and end times of a transaction. For example Some sample data may be id | start_time | end_ti...

error during "import ibm_db"

I am getting this error ! Traceback (most recent call last): File "/home/e**/RRR/RRR_Success.py", line 37, in ? import ibm_db ImportError: libdb2.so.1: cannot open shared object file: No such file or directory Please help me to solve this problem ...

is it possible to explicity insert values in timestamp column of DB2

Hi, is it possible to explicity insert values in timestamp column of DB2? For example i have a date time value '2\11\2005 4:59:36 PM'. How to convert it to timestamp value in DB2? Thanks in advance ...

Connect MS Access to remote DB2 database without installing DB2 locally

I've found instructions on how to connect MS Access as a front-end to a DB2 database, but it appears that installing DB2 locally is a prerequisite (so that you have the DB2 ODBC driver). But I don't want to install locally. I want to connect to a remote DB2 database. I can't seem to figure out how I can get that driver installed without ...

Paramertize Fetch First n Rows Only in DB2

I'm trying to do the following: select * from table fetch first @param rows only @param is an int. DB2 would not have it. I've heard of concatenating it with ||, but I can't seem to get that to work. Anyone have experience with this? (PS I saw a similar question (http://stackoverflow.com/questions/2621420/db2-wont-all...

Set default tablespace in JDBC URL for db2 on Z/OS?

Is it possible to force all create table statements to use a specific database.tablespace by passing a parameter to the JDBC URL? For example instead of manually specifying it as follows CREATE TABLE Message (id INTEGER NOT NULL, created TIMESTAMP, message VARCHAR(255),PRIMARY KEY (id)) in DATABASE.TABLESPACE I'd like to specify "...

insert null value in db2 (control center)

This question is about the gui application (DB2 Control Center), not about sql statements At my work, we develop an application that supports sql server, oracle and db2. Therefore we use the gui applications of all three of them at varying capacity. The problem is when I edit a record and I want to insert a null value. For sql server (...