StackOverflow is a collaborative programming Q&A community venture
Note: The content of this blog is the opinion and thoughts of the blogger and does not necessarily represent the opinions of IDUG.
DB2 external stored procedure fails with CPF9810 when called from client
In a green screen session, caling a program MYLIB/TESTPRG works when my library list is set to QGPL, QTEMP, VENDRLIB1, VENDRLIB2, VENDRLIB3. I can execute
I want to be able to run this command from my Windows client. I created an external stored procedure MYLIB/TESTPROC with external name MYLIB/TESTPRG as I have seen in various articles. My original question stated that I could execute this procedure successfully in STRSQL in a green screen session with my library list as above, but that is false. It does not work. It simply says 'Trigger program or external routine detected an error.' Sorry for the wrong information.
When MYLIB/TESTPROC is called from the client (
What works is when I run the program, i.e.
TESTPRG is a C program that takes no arguments. The stored procedure was defined like this:
Can I change the datatype and max length of a column in Table B that I'm creating with a CREATE TABLE AS SELECT FROM Table A?
I would like to have the converted date formats to be in the ResultB Table instead of the CHAR type dates and I was looking for a way to do this inside the create table state in 1 go.
I have successfully created a new Table ResultB with a subset of data from source Table SourceA.There is a column UPLSTD (CHAR type) that contains dates, in order to compare with the current date I converted the CHAR type dates with a to_date function, this also works.
I want the output to be:
But the actual is:
Converting milliseconds since midnight to readable timestamp
I have an application that logs the time an action occurred in milliseconds since midnight and stores it in a Db2 10.5 database table. I need to convert that figure to a human-readable timestamp output.
I want to be able to run a SELECT but have the value returned like
Any guidance would be appreciated.
Connecting from Tomcat to AS400 : java.lang.UnsupportedOperationException: Not supported by BasicDataSource
I have already gone through most of the java.lang.UnsupportedOperationException: Not supported by BasicDataSource articles on Stack Overflow and other sites. Nothing worked for me.
I'm trying to migrate an application that is currently working in IBM Websphere Application Server to Tomcat.
This application is using a proprietary jar file which creates the DataSource object and calls the datasource.getConnection(). I used a decompiler to see the source code and found this:
On debugging, I found that, this.datasource is getting org.apache.tomcat.dbcp.dbcp2.BasicDataSource object assigned to it instead of the AS400JDBCDataSource object. I have added the jt400 jar file (which contains this class) in project lib as well as tomcat lib.
AS400JDBCDataSource class implements DataSource and has it's own implementation of getConnection which is what I need to be called, but that's not happening.
I'm getting this error while tomcat starts :
How can I debug this issue?
Trying to run dynamic sql using a UDF in DB2
I am very new to DB2 even though have experience in Oracle. I am not able to resolve this issue.I have a requirement where I need to find missing child records in the parent table .The parent table , child table and the join_key are all passed as input parameter.
I have tried this in a procedure was able to achieve this, but the admin wants it in a function so that they can just use it in a select statment and get the result in a table format. Since the parent table , child table and the join_key are comming as input parement, I am not able to run them as dynamic sql.
When I try to compile it , it says prepare is invalid , I have tried even execute immediate but that also gave error.Can you please help me with how to use dynamic sql in UDF or an alternative logic for this problem
Group by category,store and attribute and assign sequence based on alphabetical order of attribute name
In a DB2 database I have 2 tables
I am trying to create an SQL query using which I want to assign sequence value to attributes in category-store-attribute relationship based on alphabetical order of attribute name like below.
I tried using ROW_NUMBER function but without any luck.
I could not find a way to group the results based on store_id, category_id and attribute_id and then assign the sequence.
Any help would be appreciated!
I am trying to migrate an application from Websphere to Tomcat and facing an issue.
I have this jar com.ibm.ws.runtime-220.127.116.11 in the lib, but it doesn't have this particular DB2AS400DataStoreHelper class inside rsadapter package.
Can someone please help me with the jar or the version number which has DB2AS400DataStoreHelper class?
Running db2relocatedb with ansible
I have this ansible playbook:
if I run the command by itself it works and if I use cat /db2/myins/relocate.cfg instead of db2relocatedb -f it works too.
If I run it like this I get:
Why can I cat the file but not use it?
how to retrieve JSON data stored in CLOB Datatype in DB2?
I have JSON data stored in CLOB in DB2 database. I want to query this JSON data and retrieve some data .
I tried with
can anyone please let me know if I can use JSON_VAL if not right one with an example helps.
Running DB2 client container as non root user
I am building a docker container with db2 client installed. Following this instruction I am able to build a docker image with db2 client installed. Here is the dockerfile:
But I face a problem that when I run it in the kubernetes environment, it can not be started because the container there can be run only as non-root user. Following log is displayed:
I can not change the config in the kubernetes environment therefore I have to change my dockerfile to start the container as non-root user. I tried to change in the dockerfile the