Questions tagged [db2]

DB2 is a family of database servers developed by IBM. Supported platforms for DB2 servers are z/OS (formerly OS/390), Linux, UNIX, and Windows (referred to collectively as DB2 for LUW), and IBM i (formerly OS/400 or i5/OS). Originally designed as a relational engine, IBM has expanded DB2's capabilities on some platforms to include native XML support and an RDF-compliant graph store. When posting DB2 questions, please specify the platform and version.

DB2 is a family of database servers developed by IBM. The supported platforms for DB2 servers are z/OS (formerly OS/390), Linux, UNIX, and Windows (referred to collectively as DB2 for LUW), and IBM i (formerly OS/400 or i5/OS). Originally designed as a relational engine, IBM has expanded DB2's capabilities on some platforms to include native XML database features and an RDF-compliant graph store. On the IBM i platform, DB2 for i is tightly integrated into the operating system in a variety of ways, including a unique file system layer that allows database tables to be treated as structured files and vice versa.

DB2 for LUW has different editions: Express-C, Express Edition, Workgroup Server Edition, Enterprise Server Edition and Advanced Enterprise Server Edition. Each of these editions has different engine capabilities and different limits on the amount of RAM and the number of CPU cores that DB2 can use. DB2 for LUW offers a smooth upgrade path for databases that were created in a lower edition of the product (e.g., going from Workgroup Server Edition to Enterprise Server Edition).

DB2 Express-C is a no-cost DB2 engine that runs on Linux and Windows and is authorized for production use and redistribution. As part of the DB2 10.5 release in June 2013, IBM extended the system resource limits for DB2 Express-C to allow the database engine to use up to 16GB RAM and two CPU cores and set a maximum size of 15 terabytes per database.

In October 2009, IBM introduced DB2 pureScale, a database cluster solution for AIX on System p, suitable for online transaction processing (OLTP) workloads. Linux x86_64 support for DB2 pureScale on IBM System x hardware was added in August 2010. IBM based the design of DB2 pureScale on the Parallel Sysplex implementation of DB2 data sharing on z/OS. DB2 pureScale provides a fault-tolerant, clustered database engine that uses low-latency RDMA messaging and GPFS shared storage to present the appearance of a single, monolithic database to the application layer.

To handle large data volumes and complex queries that are common to online analytical processing (OLAP), DB2 for LUW provides a shared-nothing clustering implementation known as the database partitioning feature (DPF), which uses hash key partitioning to evenly distribute a single copy of the database across multiple servers. Incoming queries are automatically multiplexed to access multiple partitions in parallel. DPF was introduced in 1994, as was at times rebranded as DB2 Parallel Edition, DB2 Extended Enterprise Edition, or InfoSphere Warehouse.

The 10.5 version includes the BLU acceleration that consists in storing the data in columnar format. It allows us to store data in rows or columns, and that improves analytics performance.

Free DB2 Books

11368 questions
108
votes
3 answers

Difference between CLOB and BLOB from DB2 and Oracle Perspective?

I have been pretty much fascinated by these two data types. According to Oracle Docs, they are presented as follows : BLOB : Variable-length binary large object string that can be up to 2GB (2,147,483,647) long. Primarily intended to hold…
The Dark Knight
  • 4,986
  • 10
  • 42
  • 86
94
votes
10 answers

Equivalent of LIMIT for DB2

How do you do LIMIT in DB2 for iSeries? I have a table with more than 50,000 records and I want to return records 0 to 10,000, and records 10,000 to 20,000. I know in SQL you write LIMIT 0,10000 at the end of the query for 0 to 10,000 and LIMIT…
elcool
  • 5,551
  • 7
  • 26
  • 43
64
votes
3 answers

Relationship between catalog, schema, user, and database instance

To compare databases of different vendors (Oracle, SQL Server, DB2, MySQL, and PostgreSQL) how can I identify any object uniquely and do I need a catalog? For instance, In Java's DatabaseMetadata I should specify catalog and schema fooPattern at…
ruruskyi
  • 1,874
  • 2
  • 23
  • 35
57
votes
15 answers

How to check db2 version

How to check db2 version on Z/OS using only SQL commands? Thanks, Melita
gizmo
  • 7,229
  • 6
  • 21
  • 21
48
votes
11 answers

SQL Statement with multiple SETs and WHEREs

I am wondering if this is a valid query: UPDATE table SET ID = 111111259 WHERE ID = 2555 AND SET ID = 111111261 WHERE ID = 2724 AND SET ID = 111111263 WHERE ID = 2021 AND SET ID = 111111264 WHERE ID = 2017
ProgramNov
  • 491
  • 1
  • 4
  • 4
47
votes
19 answers

How to view DB2 Table structure

How to view the table structure in DB2 database
Ambat bhath
  • 1,275
  • 1
  • 11
  • 23
45
votes
14 answers

DB2 Query to retrieve all table names for a given schema

I'm just looking for a simple query to select all the table names for a given schema. For example, our DB has over 100 tables and I need to find any table that contains the sub-string “CUR”. I can use the like command once I have all the tables.
Ben
  • 2,149
  • 4
  • 26
  • 41
39
votes
1 answer

Trying to get the average of a count resultset

I have the following SQL:(bitemp) SELECT COUNT (*) AS Count FROM Table T WHERE (T.Update_time = (SELECT MAX (B.Update_time ) FROM Table B WHERE (B.Id = T.Id)) GROUP BY T.Grouping now I am getting a resultset…
Xavjer
  • 7,803
  • 2
  • 19
  • 39
39
votes
8 answers

How to find substring inside a string (or how to grep a variable)?

I'm using BASH, and I don't know how to find a substring. It keeps failing, I've got a string (should this be an array?) Below, LIST is a string list of database names, SOURCE is the reply, one of those databases. The following still doesn't…
edumike
  • 2,897
  • 6
  • 22
  • 31
39
votes
5 answers

Does DB2 have an "insert or update" statement?

From my code (Java) I want to ensure that a row exists in the database (DB2) after my code is executed. My code now does a select and if no result is returned it does an insert. I really don't like this code since it exposes me to concurrency…
Mikael Eriksson
  • 443
  • 1
  • 4
  • 7
37
votes
4 answers

How to AUTO_INCREMENT in db2?

I thought this would be simple, but I can't seem to use AUTO_INCREMENT in my db2 database. I did some searching and people seem to be using "Generated by Default", but this doesn't work for me. If it helps, here's the table I want to create with…
Matt
  • 4,338
  • 11
  • 46
  • 72
36
votes
8 answers

Connect PHP to IBM i (AS/400)

I've got an upcoming project wherein I will need to connect our website (PHP5/Apache 1.3/OpenBSD 4.1) to our back-end system running on an iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am…
dragonmantank
  • 14,475
  • 19
  • 80
  • 90
36
votes
12 answers

How to connect Python to Db2

Is there a way to connect Python to Db2?
Rohita Khatiwada
  • 2,563
  • 7
  • 37
  • 52
35
votes
5 answers

insert multiple rows into DB2 database

I want to insert multiple rows into a DB2 table. I have a query that looks like this insert into tableName (col1, col2, col3, col4, col5) values (val1, val2, val3, val4, val5), (val1, val2, val3, val4, val5), (val1, val2, val3, val4,…
Frantumn
  • 1,545
  • 6
  • 32
  • 57
33
votes
5 answers

Create a copy of a table within the same database DB2

Is there an easy way to copy a table to the same database of course with different name. I tried some of these listed below, db2 "CREATE TABLE SCHEMA.NEW_TB COPY AS SELECT * FROM SCHEMA.OLD_TB WHERE 1 = 2" db2 "SELECT INTO SCHEMA.NEW_TB FROM…
Govind Kailas
  • 2,089
  • 4
  • 18
  • 23
1
2 3
99 100