db2

DB2 cascade delete command?

Is there a special syntax to execute a cascade delete on DB2 or is it only possible to create "cascadable" tables by defining them with the "ON DELETE CASCADE" option? What I am trying to achieve is delete other table rows based on a same foreign key when I delete that key, but this is done on an already existing and data-filled databas...

What is stored in the JNDI cache?

We are using WebSphere 6.1 on Windows connecting to a DB2 database on a different Windows machine. We are using prepared statements in our application. While tuning a database index (adding a column to the end of an index) we do not see the performance boost we saw on a test database with the same query, after changing the index the pr...

Is there JavaDoc available for DB2 drivers?

Is there anywhere I can point my IDE to and associate my DB2 driver (db2jcc.jar) to get the JavaDoc support? I looked through what is installed locally on my computer, and there doesn't seem to be anything. Is it available online at all? ...

SQL0100W Error on DB2

I get the following error when running an sqr report on DB2: SQL0100W - No row was found for FETCH, UPDATE or DELETE; or the result of a query is an empty table. SQLSTATE=02000 The sql in question runs correctly when I paste it into RapidSQL, replacing the parameters. The sql in question is an insert-select. No rows are returned by t...

DB2 hang when query or opening large table

Hi There I have a problem here. I have a DB2 v8.1 where I have this particular table which I cannot query or open. Whenever I tried to query or sample data it will tell me its a timeout/deadlock issue after for long time. No one is using the table so it cant be deadlock. Is there anyway i can recover this table? thanks. ...

How can one debug/fix an everlasting null return from EntityManager's find?

Hello! I am following this example . I keep getting this error whenever calling upon find: java.lang.NullPointerException at LoginAction.service(LoginAction.java:41) at Dispatcher.doWork(Dispatcher.java:82) at Dispatcher.doGet(Dispatcher.java:64) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax...

DB2 Stored Procedure DBVisualizer

I am using DBVisualizer to execute a z/os DB2 stored procedure. Call DB001.MYTEST2('NY', 'Brooklyn', '11229', '2009-07-31'); I get this error message, Literal replacement parsing failed for procedure call to DB2 for z/OS. ERRORCODE=-4463, SQLSTATE=42601 Has anyone seen this before? ...

Sharing a Java synchronized block across a cluster, or using a global lock?

I have some code that I want to only allow access to by one thread. I know how to accomplish this using either synchronized blocks or methods, but will this work in a clustered environment? The target environment is WebSphere 6.0, with 2 nodes in the cluster. I have a feeling that synchronized won't work, since each instance of the ap...

DB2 Exclude Nulls or set to arbitrary date

I am having a very difficult time handling null returns in DB2. I've tried IFNULL AND COALESCE functions, but I still end up getting values in the return. Here is the relevant segment of the query: COALESCE ( DATE ( SUBSTR (DIGITS (PODATE),1,2) || char ('/') || SUBSTR (DIGITS (PODATE),3,2) || char ('/') || ...

DB2 Java user defined function

Hello, I'm trying to write a Java function for my DB2 database. When my class is in SQLLIB/Function all is working great. Now i need to change the path of the class to another location for client deployment. I can't seem to make it work. Please Help! Thanks. ...

DB2 SQL - median with GROUP BY

Hi everybody, First of all, I am running on DB2 for i5/OS V5R4. I have ROW_NUMBER(), RANK() and common table expressions. I do not have TOP n PERCENT or LIMIT OFFSET. The actual data set I'm working with is hard to explain, so let's just say I have a weather history table where the columns are (city, temperature, timestamp). I want ...

Spring Datasource and Database Schema

Hi I am trying to declare a Spring datasource pointing to a DB2 database. Presently I am using a org.springframework.jdbc.datasource.DriverManagerDataSource to setup the connection but am not finding any way to specify the database schema in the database in the datasource bean. Could anyone help me on this? ...

DB2 AS400 Java function always returns same value

Hello, I am writing a user defined function to DB2 on AS/400 in Java and the strangest thing happen.. I am always getting the same result from the function even when i am changing it, even if i am dropping it and create it again and even when i specify NOT DETERMINISTIC.. Does any one have ever encountered a behavior like that? ...

Running DB2 Stored Procedure

I am running a db2 stored procedure from the db2 connect query editor. 6 out of 9 of my stored procedures run without a problem. However 3 of the stored procedures cause the db2 connection to be lost and I get an error msg that db2bp.exe failed. All of the stored procedures where based on the same program. Does anyone know what could ca...

Add a field description to a DB2/400 file

I have a set of files in a library on an AS/400/iSeries/System-I/iSeries/whatever-IBM-wants-me-to-call-it-these-days which I do not have DDS for (created in SQL I gather) but to which I would like to add field descriptions. I cannot find a way to do this on the 400. Does anyone know how I can add field description? Is directly updat...

DB2 how to send an email from Stored Procedure?

Team, I have scenerio where in i need to send an email from my stored procedure in DB2. However i have not been able to figure out any so far, apart from using Task Center or Query Patroller. Can any one suggest me some pointers to this? I do not want to do it from any other language though. Thanks, Harveer ...

Update Query with Join in DB2/AS400

Hi, I'm somewhat new to DB2 on an AS400, today I managed to set the value of a single field to the wrong amount in 300k+ records, and now I need to fix it... I'm having a problem with the UPDATE statement: UPDATE WHSPSLP SET WHSPSLP.WHS_TOT_VALUE = BUWHSPSLP.WHS_TOT_VALUE WHERE WHSPSLP.WHS_PSLP_NO = BUWHSPSLP.WHS_PSLP_NO I'm updating...

DB2 Client v9.5 on Win 2003 Taking Long time to establish Connection

Hi, I have a ASP.NET application running on Windows 2003 that needs to communicate with a DB2 database that resides on the mainframe. We installed DB2 Client driver v9.5 on our server so the application can perform the connection and work with the database. The connection string to connect to the database contains the username and passw...

Hibernate / DB2 -913 deadlock

An application deployed on several machines - accesses the same DB Table. It reads the MIN row and then deletes that row. When this happens concurrently, we get a -913 error from DB2 signifying deadlock. Have tried following options already 1. locks on row. 2. re-try mechanism in application code, after the deadlock occurs. Nothing se...

Spatial SQL: Most suitable datatype for a square?

I have a spatially enabled database (DB2, in this case). I need to store a large number of squares in a table. Which standard spatial SQL datatype is most suitable? I guess I could use an ST_polygon, but maybe there is a more specialized type which would give better performance better data guarantees (I want to catch it as an error if...