DB2

5K

Solutions

3

Articles & Videos

3K

Contributors

IBM DB2 is a family of relational database server products developed by IBM that have been extended to support object-relational features and non-relational structures like JSON and XML. There are three main products in the DB2 family: DB2 for Linux, UNIX and Windows (informally known as DB2 LUW), DB2 for z/OS (mainframe), and DB2 for i (formerly OS/400), plus a version for IBM's Virtual Storage Extended (VSE) operating system.

Share tech news, updates, or what's on your mind.

Sign up to Post

We have problem with the application run DB2ResultSet.Read(). sometime will get EROR [24000] [IBM] CLI0115E  Invalid cursor state. SQLSTATE=24000.

Database : DB2 for Linux, UNIX and Windows V10.5
Client: Windows 7 64bit

Method:
public int EventGetEvSegmentCnt(string SegmentID, string strEvntGroup)
        {
            int strGroupCnt = 0;
            string strSQL = string.Empty;
            DB2ResultSet objRs;
            if (string.IsNullOrEmpty(SegmentID) || string.IsNullOrEmpty(strEvntGroup))
            {
                strGroupCnt = 0;
            }
            else
            {
                strSQL = " SELECT COUNT(EVNT_CODE) AS EVNT_GROUP_COUNT FROM E_SEGMENT_EVENT WHERE C_SEGMENT_ID = " + SegmentID + " AND EVNT_GROUP = " + strEvntGroup;
                Common.DatabaseHelper helper = new Common.DatabaseHelper();
                objRs = helper.ExecuteResultSet(strSQL);
                if (objRs.Read())
                {
                    strGroupCnt = 0;
                }
                else
                {
                    strGroupCnt = int.Parse(objRs["EVNT_GROUP_COUNT"].ToString());
                }
            }
            return strGroupCnt;

        }

Error Message:
[Information]      System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> IBM.Data.DB2.DB2Exception (0x80004005): ERROR [24000] [IBM] CLI0115E  Invalid cursor state. SQLSTATE=24000
   at …
0
Increase Agility with Enabled Toolchains
Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Microsoft provides a development SQL server that can run on your laptop or PC for developers to work against. I can put a Northwind database on such for example, and devise queries against it. I am looking for similar tools that I can do so for these database formats, if there is such an animal...

DB2
Oracle
SAP
AS400
0
"OF DEL MODIFIED BY COLDEL,REPLACE" works fine and was able to load the records into the database
modified the same to
"OF DEL MODIFIED BY COLDEL'0x7c'REPLACE" as my original file is pipe delimited, now I'm getting below error for the same input file which worked for the "," delimited ( just did replace all for "," with "|") and there are no other ,

SQL3125W  The character data in row "F0-1" and column "1" was truncated
because the data is longer than the target database column.
0
I have the need to get a BOM with all components , currently using Tc. CK86 , but this doesn't give enough information, so I want to do this by SQL, I come from oracle background and dont know how could I get this done in DB2 R/3, I do not have access to query builder or quickview , but i do have read access via SQL, I'm currently trying to figure out a way of getting this info using tables :

MAST Material to BOM Link
STKO BOM Header
STPO BOM item

Does any of you  have a solution for this?

In Oracle I did something like the following:
SELECT DISTINCT LEVEL
	,sys_connect_by_path(msil.segment1, ' @ ') AS "BOM TREE"
	,msi.segment1
	,lpad(' ', LEVEL, '') || msil.segment1 Cod_Component
	,msil.item_type
	,msil.description Desc_Component
	,BIC.component_quantity
	,msiL.primary_unit_of_measure
FROM mtl_system_items msi
	,bom_bill_of_materials bom
	,BOM_INVENTORY_COMPONENTS BIC
	,MTL_SYSTEM_ITEMS MSIL
WHERE msi.organization_id = 332
	AND BOM.ASSEMBLY_ITEM_ID = MSI.INVENTORY_ITEM_ID
	AND BOM.ORGANIZATION_ID = MSI.ORGANIZATION_id
	AND bom.bill_sequence_id = bic.bill_sequence_id
	AND nvl(bic.disable_date, sysdate) >= SYSDATE
	AND BIC.component_ITEM_ID = MSIL.INVENTORY_ITEM_ID
	AND Bom.ORGANIZATION_ID = MSIL.ORGANIZATION_ID
	AND msil.inventory_item_status_code = 'Active'
	AND msi.inventory_item_status_code = 'Active' connect BY prior bic.component_item_id = bom.assembly_item_id
	START
                  WITH msi.segment1 = trim(:parte)
        ORDER BY 2

Open in new window

0
I had this question after viewing Number of Weeks in a particular month.

This works great for Saturday but I my week starts on Monday (day 1).  How do I change this so that I can pick a different day, example, Monday (first day) or Sunday (last day) of the week.
Thank you!
0
We have prod environment and development environment  for DB2 .

1> we are thinking of proposing have a nick schema in dev pointing to prod .
in this case we will need to make sure only specific user id will have access to these nick schema .
is it possible to do that ?

2> if we fire select on  nick schemas< with ur > ; Is it sure that we will not lock  not lock the database tables .

3> Is there any way of controlling database load on the prod databases when queries are fired by nick schema ?
0
I had this question after viewing iSeries DB2 SQL - Request user input.

I also have similar requirement and code also follows:-

Sub ChangeQueryVariables()
DIM ssql AS String, NUM AS Interger       
Dim qd as dao.QueryDef,db as dao.Database

Set db=CurrentDb()
Set qd=db.QuerDefs("BM")

NUM=Inputbox()

ssql=select ABAN8,ABALPH from ascrpdta.F0101 where ABAN8=&NUM"
qd.SQL=ssql
Do cmd.OpenQuery "BM"x
End sub

And error is

ERROR: [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0104 -
Token SUB was not valid. Valid tokens: ( CL END GET SET CALL DROP
FREE HOLD LOCK OPEN WITH ALTER BEGIN. Error Code: -104

Query = Sub ChangeQueryVariables()
DIM ssql AS String, NUM AS Interger       
Dim qd as dao.QueryDef,db as dao.Database

Set db=CurrentDb()
Set qd=db.QuerDefs("BM")

NUM=Inputbox()

ssql=select ABAN8,ABALPH from ascrpdta.F0101 where ABAN8=10000
qd.SQL=ssql
Do cmd.OpenQuery "BM"x
End sub

Please suggest

Regards
Suresh
0
Hello. I imported a txt file as a table into QMF and a couple of my columns are displaying as 4.43300000000000E+001, etc.. How can I convert/format these to standard numbers in my query?

Thanks in advance,

James
0
Hi,

Can we have CDC data mirroring between 2 different version servers.
Example a table is in V5R3 and we create the same table in V7R2 and we would like to have the data replicated from V5R3 to V7R2.

Is this possible. Do you see any issues.

Thanks
Chaitu
0
Hi,

I'm working in the DATA WAREHOUSE PROJECT, Does anyone have the industry best practices on how to build a  TEST cases.

Such as Tools, Technique, the methodology used?
0
Turn Insights Into Action
Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Hello,

We have an index corruption Issue at (HADR environment ) founded into db2diag of primary caused crash , this corruption occurred on primary. I've decided to

1-takeover on standby as no page corruption there and deactivated primary to avoid this corruption moved to standby
2-backup (new primary ) and drop db on old primary
3-restore on old primary (standby) , then working successfully

but doesn't know what the root cause of this page corruption I faced this issue twice during 40 days. My suspect is maybe index not building at true bases, even db2support hadn't got particularity more details they said maybe application code

Is there any way to ensure an index is working fine or not?
As my understanding, there are many flavors of index-related corruption problems, for instance:

Unique index contains duplicates with different RID(s) or same RID(s)
Multiple index entries pointing to the same RID
Index key is out of place (wrong index key order)
Row exists, but index keys do not exist in any or some of the indexes
Index entry pointing to an empty data slot or unused data slot or RID is invalid
Incorrect previous or next index page pointers, incorrect high key or other corruptions on index pages

And if this happens again, is there any different method unless backup and restore?

I found This maybe can be a solution could you  please give me your thoughts  can i do this as a solution ???

REORG the corrupted indexes or mark the index as bad by …
0
I need suggestion around tools that can be used to convert sql, procedures from Oracle DB to IBM DB2 database.
Thanks in advance
0
I have followed instruction for creating /etc/init/db2fmcd. It's still won't restart.

I have tried the following link

http://www-01.ibm.com/support/docview.wss?uid=swg21209001

I still get the following

Gcf module 'fault monitor' is INSTALLED PROPERLY but NOT ALIVE
Gcf module '/opt/ibm/db2/V10.5/lib32/libdb2gcf.so' is INSTALLED PROPERLY but NOT ALIVE


If I run /opt/ibm/db2/V10.5/bin/db2fmcd by itself it just hangs.
0
I have access database that runs 3 business rules and updates a final table in access.  The logic is in the module rule mod.   I need to loop through 10 million row tables in access and perform procedure logic against the record set.  I am thinking before the database gets to big I should process this information on Teradata platform.  Somehow convert this access module in a stored procedure if that is possible. Or there might be another way through subqueries to get the final outcome.

Sample Database
Customer      Product      Orderdate
11111      VIP      01/01/2017
11111      PLANE      01/16/2017
11111      HOTEL      02/05/2017
22222      VIP      01/01/2017
22222      PLANE      02/28/2017
33333      VIP      01/01/2017
33333      VIP      01/06/2017
33333      HOTEL      01/17/2017
44444      VIP      01/01/2017
55555      VIP      01/01/2017
55555      VIP      02/15/2017
66666      VIP      01/01/2015
66666      VIP      01/28/2017
66666      PLANE      01/29/2017
66666      OTHER      02/01/2017


Business Rule 1 - The first product that has to be ordered is the VIP PRODUCT by customer.
If the VIP PRODUCT is not ordered all rules fail.
Business Rule 2 - If VIP PRODUCT was ordered where there any orders placed within 30 days of the first order for each customer.

Final Output - should look like this:
CustomerID      CustomerName      OrderRuleTest      ProductRuleTest      OrderDateTest      OrderDateFlag
11111      Customer A      PASS      PASS      PASS      1
33333      Customer C      PASS      PASS      PASS      1
myWork_v5.accdb
0
I want to do something that seems like it should be very simple... I have single db2 instance, single db on it, I need a single user's credentials that will work to login via jdbc and have full rights to the DB (i.e. create/drop schema, etc)   But I can't get it to work.

I have a db2 10.5 instance installed on a RHEL 7 VM - I have created a DB, lets call it db123

I can access the DB fine if I am logged into VM on command line.  The username is dbinst1.  

I just want to be able to connect to this via squirrel (or other jdbc based client).  But I am getting authentication failure.  As far as I understand db2 uses OS authentication.   I am unable to log in as user db2inst1 it says

com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException: [jcc][t4][2013][11249][3.68.61] Connection authorization failure occurred.  Reason: User ID or Password invalid. ERRORCODE=-4214, SQLSTATE=28000

Open in new window


I thought maybe that user is now allowed to log in remote - so I create another user, lets say user123.  I added them to the db2inst1 group (which I think means they should have admin rights), I also get same message when I try to login to that user via squirrel.
0
Hi,

  I have a Stored Procedure, which returns 15 fields.
I wanted to capture the results from that SP, store it in a Global Temp table, and filter for a where condition.
When i call the second SP, it is not returning all the records it's supposed to return.

Attaching the code i wrote. Can someone help me understand what the issue may be?
0
I Gurus,

I want to design a script which will take last 12 hours using timestamp with specified date not like current time stamp and after 5 min if i run  the script it will take updated records and also it will delete the records from last 5 min.
Like a queue for ticket counter.

Thanks in advance any help will be appreciated.
0
does entity framework 6 will support ibm db2?
0
I am trying to implement a solution to the problem using SQL (DB2).

A month is defined based on below condition :
If 1st of month is on a Wednesday or earlier, then that corresponding Monday marks the beginning of the month
Say : Mar 1 2017 was a Wednesday so the month 201703  will start from 28th Feb.
If 1st of month is on a Thursday or later, then the next Monday marks the beginning of the month.
Say :  Apr 1 2017 is a Saturday so the month 201704 will start from  3rd April.

Now based on the logic,  I need to update the month for each and every date in a table. The date could be of any value. Accordingly to above month definition, I should update the month value.

Say 28-03-2017 should belong to 201703 , 01-04-2017 should still belong to 201703 etc.

could someone advise.

thanks
0
Get Actionable Data from Your Monitoring Solution
Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

I have used below lines to execute the stored procedure. But it didn't return any results. could you please help me regarding that.

proc sql;
   connect to db2;
   execute (call "DBAB.SP10");
quit;
0
Hello. I am trying to create a crosstab query in QMF/DB2. I know that there is no Transform function so can this be done in QMF/DB2?
The fields I'm working with are Store#, CSG, and Order#. I would like the row headings to be the Store#, the column headings to be the CSG,
and I want to calculate the count of Order#.
Thanks,
James
0
SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "START". Expected tokens may include:  "DATABASE".  SQLSTATE=42601
0
Hello,
On an IBM DB2 10 database.
A table is locked in 'super exclusive mode', any acces on it can be done.
There was a reorg on it who failed, who let this table in this state.
The DBADMIN is in holidays, unreachable, i have to know how to do to 'release' the table.

I can not delete or truncate anything on it, ther is sensitive datas.

Thanks for your help
0

DB2

5K

Solutions

3

Articles & Videos

3K

Contributors

IBM DB2 is a family of relational database server products developed by IBM that have been extended to support object-relational features and non-relational structures like JSON and XML. There are three main products in the DB2 family: DB2 for Linux, UNIX and Windows (informally known as DB2 LUW), DB2 for z/OS (mainframe), and DB2 for i (formerly OS/400), plus a version for IBM's Virtual Storage Extended (VSE) operating system.

Top Experts In
DB2
<
Monthly
>