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

12687 questions
15
votes
4 answers

How to prevent SQL injection when the statement has a dynamic table name?

I am having code something like this. final PreparedStatement stmt = connection .prepareStatement("delete from " + fullTableName + " where name= ?"); stmt.setString(1, addressName); Calculation of…
Vicky
  • 1,135
  • 1
  • 17
  • 37
15
votes
1 answer

Why do I get SQLCODE=-204, SQLSTATE=42704 with DB2 LUW and WebSphere App Server?

There are numerous web pages where people show this message as a symptom (with the value after SQLERRMC and the driver level varying): DB2 SQL Error: SQLCODE=-204, SQLSTATE=42704, SQLERRMC=M51Dev.CUSTOMER, DRIVER=3.61.65 including several here on…
Martin McCallion
  • 743
  • 1
  • 4
  • 22
15
votes
2 answers

Fetching rows in DB2

I know in DB2 (using version 9.7) I can select the first 10 rows of a table by using this query: SELECT * FROM myTable ORDER BY id FETCH FIRST 10 ROWS ONLY But how can I get, for example, rows 11 to 20? I can't use the primary key or the ID to…
David Caissy
  • 2,181
  • 5
  • 24
  • 26
15
votes
3 answers

How to make JDBC SQLExceptions for DB2 more descriptive?

How to make SQLExceptions thrown by DB2 JDBC driver more descriptive? Currently I am getting this kind of exceptions. It is cumbersome to work with these cryptic SQLCODE and SQLSTATE numeric values. Is there a way where to make the SQL exception to…
Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183
14
votes
5 answers

Calculating how many days are between two dates in DB2?

I need to get the difference in days between two dates in DB2. I tried a couple of different queries but nothing seems to be working. So basically what i need to get is something like this. SELECT DAYS (CURRENT DATE) - DAYS (DATE(CHDLM)) FROM…
jorame
  • 2,147
  • 12
  • 41
  • 58
14
votes
2 answers

db2 query to select the first row fetched

I have a query like UPDATE PRD_PRODUCT_L10N ppl SET ( CATCHING_PHRASE , GENERIC_NAME , INGREDIENTS , QUANTITY , DOSE , NUTRITION_FACTS , PRODUCT_DESCRIPTION , PROMOTION_MESSAGE , MESSAGE ) = ( SELECT distinct…
beetri
  • 1,039
  • 11
  • 24
  • 40
14
votes
3 answers

Get Distinct property values from List

I am trying to get distinct FullNames from a list that contains FullNames and IDs then displaying these in a listBox control. Is there a simple way to do it? Thanks Ben using (DB2DataReader dr = command.ExecuteReader()) { …
Ben
  • 1,113
  • 5
  • 15
  • 25
14
votes
3 answers

How do I write a query that outputs the row number as a column?

How do I write a query that outputs the row number as a column? This is DB2 SQL on an iSeries. eg if I have table Beatles: John Paul George Ringo and I want to write a statement, without writing a procedure or view if possible, that gives me 1…
nearly_lunchtime
  • 12,203
  • 15
  • 37
  • 42
14
votes
6 answers

java.lang.UnsatisfiedLinkError while loading DB2 JDBC driver

I try to use jboss-seam with a db2 database, the following error occurs com.ibm.db2.jcc.a.SqlException: [jcc][10389][12245][3.52.95] while loading the native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path an…
stacker
  • 68,052
  • 28
  • 140
  • 210
14
votes
4 answers

What can SQL CODE -104 (error) represent?

I am executing an SQL query via jcc to run a report. When I opened the error log file for the program and examined the SQL query, everything seems to be fine (There are no extra or missing brackets, commas, etc and the syntax is good) however when I…
Bernice
  • 2,552
  • 11
  • 42
  • 74
14
votes
5 answers

sort query result without selecting that column but sort by that column?

I have a query, I have to sort the result from the DB2 database. The query will select the columns empname,salary,status. But I have to sort the result using order by empno But the query is not working.. This is the query. select empname, salary,…
Mr.Chowdary
  • 3,389
  • 9
  • 42
  • 66
14
votes
1 answer

ERRORCODE=-4461, SQLSTATE=42815 in DB2

I have exported some data from schema A (table x)to XML and I am reading the XML and inserting the data into schema B(table y). while inserting the data after 20000 records it says com.ibm.db2.jcc.am.SqlSyntaxErrorException:…
user1374266
  • 323
  • 1
  • 4
  • 19
13
votes
2 answers

How to use NOT EXISTS with COMPOSITE KEYS in SQL for inserting data from POJO

I am using DB2 DBMS. Scenario 1: myTable has a composite key (key1, key2) where both key1 and key2 are foreign keys from yourTable. I want to insert new data from yourTable into myTable, but only if the key1, key2 combination does not already exist…
Vicky
  • 16,679
  • 54
  • 139
  • 232
13
votes
3 answers

how to connect hibernate and DB2

I am running an application that used struts and hibernate. I am currently using Derby database. Now i have to shift on DB2 database. Please tell me what Configuration I have to do in hibernate configuration file? Do I have to set any…
Muhammad Imran Tariq
  • 22,654
  • 47
  • 125
  • 190
13
votes
5 answers

Differences between DB2 and Oracle

We had a talk with colleagues about databases yesterday as we will have a DB2 education in few weeks. I'm wondering, what are the differences between DB2 and Oracle as two major enterprise solutions? Are there any limitations in comparison to each…
Ondrej Slinták
  • 31,386
  • 20
  • 94
  • 126