db2

DB2 9.7 cannot enable PL/SQL syntax

After I installed DB2 9.7 Express, I tried to enabled DB2 to support PL/SQL by following command: DB2SET DB2_COMPATIBILITY_VECTOR=ORA then I got result as below: DBI1301E Invalid value. Explanation: The value specified for the registry variable is invalid. User response: Refer to the DB2 Information Center to determine the valid...

DB2 Multiple Index on same column combinations

Lets say I've a table T with columns C1, C2 ... C10. C1, C2 and C3 are most frequently refered columns in multiple queries. The order in which these columns are refered can't be controlled. To improve query performance do I need to create multiple indexes such as (C1, C2, C3), (C1, C3, C2), (C2, C1, C3), (C2, C3, C1) etc.? With exampl...

ASP.net site designed/built on SQL Server Transistion to DB2

OK long story short, we designed and built a web application connecting to a standalone SQL Server 2000 database using asp:SqlDataSource and System.Data.SqlClient, now we are looking at migrating to a db2 cluster. Aside from the connection string, do we need to do anything on the web application? I am clueless about DB2. We have close to...

How do I select min/max dates from table 2 based on date in table 1?

I have a monthly table (only holds rows with first day of month, and unique constraint so only one of each) and a daily table with similar information for each day (same deal, only one per day): Monthly table Daily table ------------- ----------- 2009-01-01 2009-01-01 2009-02-01 2009-01-02 : : ...

Command substitution in the same shell, db2 reports no connection

I have the following snippet in a bash script: db2 connect to $DB var=$(db2 -x "$query" | tr -d " ") $query holds a select count query, -x just prints out the result of the command with no headers so var would be assigned to a number. What happens is that $(...) is executed in a subshell and doesn't inherit the connection to DB2 resu...

NHibernate - Why is connection needed to build factory if connection can be passed to session constructor?

I'm new to NHibernate and am attempting to use it to connect to DB2. After trial and error and research, and more trial and error and research, I've finally come down to an error to which I cannot find an answer. The error message reads: "The user must provide an ADO.NET connection - NHibernate is not creating it." This error is not ve...

What is Type 4 XA driver?

In our application when we create the Datasource, we select the Database Name DB2 Driver: BEA Type 4 XA DB2 But what i know is, there are only 4 types of Driver. Then what is Type 4 XA driver? ...

SQL1092N "ASPNET" does not have the authority to perform the requested command. Basic ODBC call to a dsn does not work.

Don't shoot me for this, but I've posted this on experts-exchange as well. I just need an answer. Here's the question (and yes, i've searched, googled, and searched again): I'm getting some very strange errors on boiler plate odbc connection code. The code connects to DB2 (which is always a joy to work with) and has never given me issue...

Free alternative to DB2 for localhost development

I am looking for free DBMS options for a localhost environment, which will support migrating data and database objects (e.g. stored procedures, table definitions) to a DB2 9.5 installation. We can't use DB2 in localhost due to cost/licensing constraints, but would benefit from each developer having his/her own database to use locally. ...

NHibernate - Why does Delete() call fail to delete but delete through HQL works?

Considering the following code blocks, why does call to HQL work but call to delete() not work? As a background, I'm using NHibernate over IBM.Data.DB2.Iseries driver. Come to find out, journaling on the AS400 is turned off so I can't use transactions. I'm not the AS400 admin or know anything about it so I don't know if having journaling...

How to write the SQL for the following problem?

I have to find, if there is any row in the table for which value of col2 is duplicate. Like in the specified scenario row 1 and 2 are duplicate as value of col2 is same. Table ------------------- Col1 Col2 Col3 1 1 4 2 1 3 3 2 2 4 3 1 At present what i am doing is select count(*) from table...

Serializing DB/2 Triggers

We have a requirement to process transactions as an ordered sequence. Transactions are initiated on system 'A' and written to a DB/2 table. A DB/2 trigger then forwards the transaction via MQSeries to system 'B' where the transaction is completed. The problem we are having is that a race condition is established because execution of the...

How do I select min/max dates from table 2 based on date in table 1 (without getting too much data from sums)

Related to a question I asked earlier here, I've found a problem which is eluding me (obviously). The original question was how to select a min and max date from a daily table based on a monthly table where some daily table dates could be missing. Basically what I needed was columns containing the month date (always the first), the earl...

Tossing out certain result rows in a left join

In DB2, using the following left join select a.deptno, a.deptname, b.empno from #dept a left join #emp b on a.deptno = b.workdept on two tables, gets me a list like: dpt name emp ---------------------- A01 ACCOUNTING 5001 A02 PAYROLL NULL A03 OPERATIONS 5003 A03 OPERATIONS 5004 A03 OPERATIONS 5007 A05 MAIN...

Adding one primary and one foreign key adds total four keys

Hi All, I am trying to alter table to add one primary key and one foreign key in a table. However when I am running the alter table query, I always get four values, two primary keys and two foreign keys. Below is the query I am running: alter table INFO add constraint pk primary key(ID_NUMBER) add constraint fk foreign key(REV_NUMBER) ...

BizTalk 2009 DB2 HIS Adapter

When using the mainframe DB2 adapter for Microsoft BizTalk 2009, is there any way to get the generated schema to contain all the columns in the result set? We get a simple schema generated, the response contains a record/element called "ResultSets" with a data structure of 'xs:anyType'. If I recall, this works okay in MS/SQL server ...

IBM Data Studio - Security when publishing stored-proc as web service

I want to publish a mainframe Z/OS stored procedure as a web sphere - more or less according to this article: http://www.databasejournal.com/features/db2/article.php/10896%5F3784896%5F3/ We got the web-server installed and started, and the stored-proc deployed to it. When we clicked the "go" to test the web service we got an SQL erro...

Cycle detection with recursive subquery factoring

Oracle SQL can do hierarchical queries since v2, using their proprietary CONNECT BY syntax. In their latest 11g release 2, they added recursive subquery factoring, also known as the recursive with clause. This is the ANSI standard, and if I understand correctly, this one has been implemented by other RDBMS vendors as well. When comparin...

AS400 DB2 Journals search

I am new to DB2 administration on AS400, could you point me to the best practices/tools to search for errors in the DB2 journals? So far I use the DSPJRN command but I am unable to make research. thanks. ...

Odd WHERE NOT EXISTS performance on DB2

I am experiencing very odd performance on DB2 version 9.1 when running the query below: select a.CYCL_NUM , a.AC_NUM , a.AUTHS_DTE , a.PL_ID , a.APRVD_RSPN_CDE , a.AUTHS_AMT , a.AUTHS_STS_CDE , a.TRAN_CTGR_CDE , a.MRCHN_CTGR_CDE , d.out_pu_au_amt from nwhd12.chldr_auths a, nwhd12.w_chldr_ac d where cycl_num = 200911 ...