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
Filter by
Sorted by
Tagged with
0 votes
2 answers
1k views

Fetch the Data from DB2 and save in MongoDB using Spring Batch without metadata tables

I need to fetch all the data from Db2 table and copy to mongoDB. I am using Spring batch without metadata tables. I am using JpaPagingItemReader for fetching data from Db2. I am able to get the data ...
Praveen Dhasarathan's user avatar
0 votes
1 answer
180 views

Multi language support while migrating from db2 to mysql

I have a database in db2 that needs to be migrated to mysql. I am exporting data from db2 to csv and then csv to mysql. The data is in multiple languages like Chinese, French, Latin, Hebrew, etc. Due ...
user2207300's user avatar
0 votes
1 answer
1k views

Can I configure SSMA to use DB2 server_encrypt authentication?

I am trying to use Microsoft SQL Server Migration Assistant (SSMA) for DB2 (version 7.5.0) to migrate a DB2 11.1 database to MS SQL 2014. The DB2 connection used to work, but fails after the ...
Rick Grant's user avatar
4 votes
4 answers
8k views

Unable to load DLL 'libdb2.so' when establishing a DB2 connection with .net core in docker

How do I make the libdb2.so file visible to the DB2 package? I have verified that the package works in Ubuntu, but I cannot make it work inside Docker. Dockerfile FROM microsoft/aspnetcore:1.0 #...
Simon's user avatar
  • 1,711
0 votes
1 answer
988 views

DB2 Select Value from final table DELETE

I haven't used the SELECT FROM FINAL TABLE clause much, but I was wondering if there was a way in DB2 to be able to select a value from a column in the same statement that I will be deleting that row. ...
Sam Williams's user avatar
0 votes
2 answers
893 views

Subselect in the ON clause

Please dont bash me if there are already answers for this question, but I found none. Basically I want to make a subselect in the ON clause of a Left join to get the newest entry in a timeframe. (...
inetphantom's user avatar
  • 2,558
0 votes
1 answer
133 views

"From" not expected on AS400 Update using a join

I am trying to update a column to today's date only if it matches data from a result set of a sub query. I have it worked up in sql, but I am trying to convert to DB2 (Operating system: i5/OS ...
eaglei22's user avatar
  • 2,690
0 votes
1 answer
472 views

PDO_ODBC accessing IBM DB2 tables with special characters in the table names

I'm working on a DB2 table on as/400. I'm trying to run a basic query against it but the table name contains a . in it. For example: my.table is the table name. The problem is that PDO believes that ...
Knight's user avatar
  • 576
0 votes
0 answers
190 views

DISTINCT AND UNION keywords cause timeout exception in iDB2Command

I'm trying to query some date from DB2/IBM AS400. for this purpose I've tested theses two libraries: Oledb and iDB2Command that iDB2Command is released by IBM in their iSerires package for .Net when ...
Masoud Sedghi's user avatar
-2 votes
1 answer
441 views

Splitting column values into rows DB2

I'm using DB2 db for fetching data. I have scenerio like to fetch values from the database like this: Select user, attributes From Data Order By DATE desc fetch first 1 rows only; Output: user ...
Vinolliya's user avatar
0 votes
2 answers
6k views

How to get count(*) total from DB2 with having clause?

How do I get the sum of all return rows with group by clause in DB2? For example: Desc Ctr ---- --- Bowl 30 Plate 21 Spoon 6 Sum 57 SELECT COUNT (name) as Desc, Count(*)...
Brandon168's user avatar
0 votes
1 answer
1k views

DB2 LUW 10.5 - How to force DB2 Stored procedures to use latest stats for most optimized plan

We see an issue occasionally. Stored procedure running a SQL runs very slow. Same SQL when run from command line runs very fast. It seems stored procedure uses a different path. The workaround for ...
Rakesh Kumar's user avatar
0 votes
1 answer
267 views

DB2 Funktion does not work, Error Code SQLCODE=-104

I just want to write a function in DB2, which gets two doubles (x and Y) and counts SQRT((XX) + (YY)). I always get the error Code: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=;;SQRT((X*X) + ...
Benedict K.'s user avatar
0 votes
1 answer
41 views

Getting a sql Error, db2 function error return result

My Function is getting a error but I don't know why ... MY (DB2)SQL CODE: CREATE FUNCTION gibX(sseries INTEGER, idd INTEGER) RETURNS Double BEGIN Declare result Double; SELECT ROW_NUMBER() ...
Di T's user avatar
  • 1
0 votes
3 answers
81 views

DB2 - Where Subquery

I currently have a problem in db2 with the following tables: Table_1 A B C 1 2 1 2 1 2 3 2 2 4 1 1 Table_2 A 1 I want to select all ...
bublitz's user avatar
  • 918
0 votes
0 answers
676 views

Is it possible to get data from MSSQL and DB2 with Dapper?

I need to get some columns from SQL Server and others from DB2. And if possible even use an inner join on them to join them (but it would already help to get data from both even if the join is ...
ttt's user avatar
  • 6,490
-1 votes
1 answer
528 views

Where can I find a Python 3-compatible library for Db2?

I have been working with Python 2 and Db2. Changing to Python 3 the same library doesn't seem to work. What can I do?
audreye's user avatar
  • 19
1 vote
1 answer
42 views

SQL to find linking column across tables without foreign keys

I am trying to find table links using duplicate column names. Say i have the following tables T1: | Prod_ID | Cust_Id | Value | | P1 | C1 | 1 | | P2 | C2 | 2 | | P3 |...
mhn's user avatar
  • 2,730
0 votes
1 answer
3k views

Spring batch with DB2 and MongoDB using Spring boot

I need to read the DB2 database and copy data to mongoDB using Spring Batch. As I am going to write the data to mongoDB, so I dont need the transaction. I would like to keep the metadata tables ...
Praveen Dhasarathan's user avatar
0 votes
1 answer
152 views

Mutex for multiple instances of a service

I have a program written in python which takes user input and updates a db table. Within that I have a separate function that will be executed as below: Insert some values with a auto increment ...
ranger101's user avatar
  • 1,184
0 votes
0 answers
2k views

IBM DB2 SQL1730N when trying to move database from one machine to another via backup/restore

I've been trying to implement the DB2 mechanism for restoring backups from one machine onto another, as part of our disaster recovery mechanism and for some kinds of problem diagnosis. I am making a ...
Felix Domestica's user avatar
0 votes
1 answer
3k views

Pivoting a table in iSeries DB2 dynamically

So what I'm trying to do is convert rows into columns. This has been covered before on this site in a verity of ways, the way I like the best is as follows: SELECT FRNPCM032.WFP.WFORD#, MAX(CASE ...
OC_'s user avatar
  • 1
0 votes
2 answers
195 views

How does 'IN' works in db2 sql query?

My requirement is to select data from DB2 table where phone number is equal to 16 set of phone numbers.I have tried to run this query given below on my local test data and my program is successfully ...
user8898467's user avatar
2 votes
1 answer
6k views

JDBC URL DB2 Encoding characters

Is there a way to set URL encoding to UTF-8 in JDBC for DB2? jdbc:db2://../characterEncoding=UTF-8; I know for MySQL that works but for DB2 it doesn't. My problem is that I try to send a ...
travis_91's user avatar
  • 173
0 votes
2 answers
377 views

Creating a stored procedure using C#, ODBC Client

In my project I have 500 plus stored procedures that needs to be created, I have created an application to read the 500 file from the directory, When I try to execute the create procedure via an ...
Anand's user avatar
  • 316
2 votes
2 answers
13k views

rownum / fetch first n rows

select * from Schem.Customer where cust='20' and cust_id >= '890127' and rownum between 1 and 2 order by cust, cust_id; Execution time appr 2 min 10 sec select * from Schem.Customer where ...
user1018926's user avatar
0 votes
2 answers
766 views

DB2 Update with subquery that contains join - correlating

I am trying to perform an update with a subquery where the update table is joined in the subquery. I cannot figure out how to associate the update record with the record found in the subquery. ...
CaptainXX's user avatar
0 votes
1 answer
659 views

The operand of the column function "MAX" includes a column function, a scalar fullselect, or a subquery.

I am trying to get number of people by age and county. Below is a picture what I am trying to achieve. Just like a Pivot table SELECT country, MAX (CASE WHEN Age = '0' THEN count(age) END) AS ...
user470091's user avatar
0 votes
0 answers
871 views

MyBatis Encoding special character

I have to do a select with myBatis to DB2 database. In the database there is a value that contains an arrow character like this "" (arrow character, ASCII table Decimal 26). When I run the query it ...
travis_91's user avatar
  • 173
0 votes
2 answers
1k views

Error when BULK Insert from a DataTable to DB2

I use WriteToServer() method of Db2BulkCopy class, in a .net project, to insert some data from data table into a table (db2). I got a very generic error that I don't know how to handle: the current ...
taia's user avatar
  • 61
1 vote
1 answer
589 views

SQL DB2 CHECK-CONSTRAINT PATTERN

I'm trying to write a constraint pattern which only allows the following: a string as follows: '+55' one blank space a number between 120 and 150 one blank space 7-9 digits. I tried a lot of ways ...
Bermie's user avatar
  • 21
-2 votes
1 answer
4k views

How to use INCLUDE in MySQL queries? [closed]

I am trying to convert CREATE UNIQUE INDEX from DB2 to mysql . I just want to know how to use INCLUDE in MySQL queries .I have searched in MySQL document and i din;t find anything . This is the sample ...
kp-vkp's user avatar
  • 7
-2 votes
2 answers
664 views

Getting MySQL syntax error on function case and VARCHAR

I am getting some SQL syntax error when i try to run a simple MySQL function create queries . These are working on Db2 . i want to run it on MySQL . CREATE FUNCTION SAMPLE1 ( I INTEGER ) ...
kp-vkp's user avatar
  • 7
0 votes
3 answers
788 views

DB2 saving a single table in database from rollback

Is there any way in db2 to keep the rows of some tables saved while the rollback is performed.We have a situation in which system rolls back in case of error, but we have a requirement in which we ...
Ravi Joshi's user avatar
0 votes
1 answer
398 views

db2cmd SQL Output Vertically

How to show the SQL table in vertically? db2 => SELECT * FROM a ===== Row #1 ===== X: 1 Y: apple Z: 10 ===== Row #2 ===== X: 10 Y: kiwi Z: 20 Normally is like this db2 => SELECT * FROM a ...
Charlie's user avatar
  • 11
1 vote
1 answer
73 views

Getting SQL syntax error during a function create on Jboss

I am getting some SQL syntax error when i try to run a simple MySQL function create query . This is the query what i tried on MySQL . This is working with Db2 . i want to run it on MySQL . CREATE ...
kp-vkp's user avatar
  • 7
0 votes
1 answer
1k views

DB2 sql - Sum of current month, quarter and year data from a table of monthly data

I have a table of monthly data having three primary keys. These are stored as one record at monthly level considering these 3 primary keys. I would like to select sum of current month data sum of ...
RRR's user avatar
  • 145
0 votes
0 answers
210 views

Pivot DB2 SQL SubQuery [duplicate]

This query gives me the results number of people with age and country. Below is a picture that I needed. Just like a Pivot table. SELECT count(age) AS numberofpeople, age, country FROM ( ...
user470091's user avatar
0 votes
2 answers
148 views

Getting syntax error during CASE WHEN query in MySQL

I am trying to run below small MYSQL query to create a table . This is the MYSQL query : CREATE TABLE SAMPLE_TEST ( ID BIGINT , TYPE INTEGER NOT NULL, TYPE2 GENERATED ALWAYS AS (CASE WHEN TYPE ...
vkp_stack's user avatar
  • 157
0 votes
2 answers
140 views

SQL-Select statement with multiple columns , with no result

I need to join two select statements in DB2 in the following way: If the first select returns no rows, then execute the second select. If the first select returns rows, then do not executes the second ...
Jad's user avatar
  • 13
1 vote
3 answers
3k views

Calculate date of birth SQL DB2 and indicate bad data

I am trying to calculate the age at the time of students admission. I have tried this query, but in some cases I have admission date is prior to their date of birth (bad data). For example: date ...
user470091's user avatar
-1 votes
1 answer
196 views

looking for Microsoft SQL Server wrapper library to federate

I'm serious in trouble. IBM's response is slow. I'm looking for module that db2 federate to SQLserver. I guess this module is called Microsoft SQL Server wrapper library. https://www.ibm.com/support/...
user3845224's user avatar
-1 votes
1 answer
178 views

Db2 stored procedure accepts user defined arraylist

Can someone please help me to find out, the process to create a stored procedure in db2 which accepts userdefined object Arraylist and call it from hibernate. Actually the requirement is i will get ...
user1912935's user avatar
0 votes
1 answer
34 views

Is there any way to dynamically choose which table's ORDER BY goes first?

I am using SQL on DB2, on an IBM Power. I have a statement which pulls in the same data from multiple CTE's then orders by a few fields. But the thing is when there are nulls in either, how can I say '...
AS4noob's user avatar
  • 123
-1 votes
1 answer
3k views

SQL query returns "value too long"

I have a SQL query that is supposed to fill a DataTable in memory but I get an error saying "Value 'Beginning of My value' is too long." The query works in a SQL editor but not when I'm running it ...
Vinnie Novido's user avatar
0 votes
1 answer
646 views

Convert excel row into txt file and insert it to DB2 in python

Hello masters of Python What I am trying to achive: I want to load data from xlsx file in to database (DB2 - connector). To do this I want to convert data from xlsx to txt file: .txt - with inserts (...
pyton17's user avatar
  • 55
0 votes
1 answer
76 views

Looking for guidelines setting proper ResultSet Type in PreparedStatement API

We recently find using resultSetType=TYPE_SCROLL_INSENSITIVE in prepareStatement(String sql, int resultSetType, int resultSetConcurrency) instead of the default prepareStatement(String sql) can cause ...
fall14123's user avatar
0 votes
0 answers
925 views

Error while creating view with 'with' statements DB2

I am trying to compile following view create view MY_VIEW as with WITH_DATA as ( select ID_TECH from CLC_TABLE where 1 = (select 1 as kol from SYSIBM.SYSDUMMY1) ) select * from ...
Michał's user avatar
  • 123
-1 votes
1 answer
2k views

100% CPU Utilization troubleshooting on db2 server

whenever we are hitting bunch of commands on database, its CPU utilization is going to 100%, is there any idea about setting of db2 server changes or anything?
Govind Gupta's user avatar
  • 1,575
0 votes
1 answer
637 views

Error while connecting to IBM DB2 with Tableau Desktop?

I'm trying to connect to a IBM DB2(v10.5) database with Tableau Desktop v10. When i enter the credentials and try to login, it shows the below error: [Microsoft][ODBC Driver Manager] Data source name ...
Vamsee Bond's user avatar

1
106 107
108
109 110
258