DB2 Z/OS - Revalidate UDF and Stored Procedure - db2

On DB2 AIX I can use the SYSPROC.ADMIN_REVALIDATE_DB_OBJECTS stored procedure to revalidate all Stored Procedures and Functions defined in my schema.
How can I do the same thing on DB2 z/OS (v.12)?
Thanks

REGENERATE automatically rebinds, at the local server, the package for the SQL control statements for the procedure and rebinds the package for the SQL statements that are included in the procedure body. If a remote bind is also needed, the BIND PACKAGE COPY command must be explicitly done for all of the remote servers.
ALTER PROCEDURE SCHEMA.NAME_SP REGENERATE ACTIVE VERSION;
For the moment I have not found anything that automatically revalidates/regenerates all Stored/UDFs of a Schema.

Related

Can't edit and execute store procedure direct from squirrel-sql client

PostgreSQL 9.6
squirrel-sql-snapshot-20220608_2238
I success connect and execute sql queries. Nice.
But when I open source of store procedure I can't modify it and can't execut it.

Is it possible using t-sql, to create a stored procedure where you query a remote database using an ODBC data-source in the stored procedure?

Is it possible, using t-sql, to create a stored procedure where you query a remote database using an ODBC data-source in the stored procedure?
I have a server with an ODBC data-source.
I use via Power Bi successfully. I would like to create a stored procedure to query the remote database using the stored procedure with the odbc data-source.
I have looked at opendatasource command, but it only uses OLE DB connections.
Thanks in advance for your time.
Dean-O
Thanks all, Tim Mylott, we got it to work, had to use the ip address of the remote server but the rest of the info given above was correct. from statements needed to include the linked_Server_Name dot DB_Name dot schema dot table_Name

Export ixf in db2

EXPORT TO myFile.ixf OF ixf SELECT * FROM TABLE_NAME WHERE SSN='DATA' AND EMPLOYER_ID=DATA AND CREATED_TS='DATA'
I am using this statement to export a couple of rows. for privacy purposes DATA has been inserted where necessary. however the following error is produced. I have followed IBM's guide on export and feel like this should be correct but unsure exactly as to what is wrong. the error log is as follows
Error: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=myFile;EXPORT TO ;JOIN, DRIVER=3.53.70
SQLState: 42601
ErrorCode: -104
As already remarked, you cannot directly run Db2-commands (such as import, export, load ... etc.) from plain SQL , as you are trying to do via JDBC.
Instead, if your Db2-server runs on Linux/Unix/Windows, you can either use a stored procedure, or (for any Db2-server operating system) you can use the command-line.
However, when you use stored-procedure SYSPROC.ADMIN_CMD for Db2-LUW, all file-names in stored-procedure parameters are relative to the Db2-server (and not your remote jdbc-client, if you are running remotely).
That means after a successful export via stored-procedure, if you really need the exported IXF file to be on your workstation then you must do file-transfer to your workstation using whatever tools you have for that purpose.
For example, this shows an export on Unix to an IXF file in /tmp on the Db2-server:
call sysproc.admin_cmd('EXPORT TO /tmp/myFile.ixf OF ixf SELECT * FROM user1.stk1 with ur') ;
If you don't want to use a stored procedure, you must use the command-line shell (for example on Windows, use db2ntcmd.bat , or on Unix use bash or ksh) and connect to the database in the shell and perform the export. This requires the workstation to have a Db2-client and also that the relevant database and node be first catalogued.
If you specify your Db2-version and the operating-system on which your Db2-server runs, then you will get more details.

passing parameter value through pgoledb to postgresql stored function

I am attempting to migrate a legacy client-server GIS application from Microsoft SQL Server to PostgreSQL. In this system the SQL Server database contains a large set of T-SQL stored procedures, each being an SQL Select query with one or more parameters.
In response to a client request, the server program – classic ASP VBScript – uses Microsoft ADODB to fill in the parameters values, execute the requested query and return the result set as an XML document to the client.
In the preliminary phase of the migration I have successfully:
installed PostgreSQL 9.3 for Windows, PgOleDB 1.0.0.20 and psqlODBC on a 32.bit Windows 7 Pro development PC
migrated the SQL Server database table definitions and constraint to a new PostgreSQL database and populated the tables using psqlODBC
using pgAdmin III, created and executed test queries against the PostgreSQL database
using pgAdmin III, created two test PostgreSQL table-valued Select functions – test1() one with no parameters and test2(text) with a single IN parameter — and verified that both execute correctly
written a test ASP/VBscript program that uses ADODB.Connection and ADODB.Command to connect to the PostgreSQL database, execute test1() - the no-parameter stored function - and create an ADODB.Recordset. This test works correctly.
However when I change my test ASP/VBscript program to use test2() and use objCmd.Parameters.Append like this:
objCmd.CommandText = "test2"
objCmd.Parameters.Append objCmd.CreateParameter("p1", adVarChar, adParamInput, 15, "000007-01012013")
to specify the required IN parameter, I get the ASP runtime error:
PgOleDB error '80004005' “Procedure name for automatic arguments is not unique“
Q1. What does the diagnostic “Procedure name for automatic arguments is not unique” mean?
Q2. Is there any public documentation available for PgOleDB other than the README.TXT and RELEASENOTES.TXT files installed along with PgOleDB.dll?

What is the standard way to write scripts to manipulate a Postgres database?

It seems that psql has no branching, and doesn't support PL/pgSQL blocks either. How do people automate Postgres database actions? Should I write functions, and just call the functions from psql?
PostgreSQL 9.0 and up lets you execute an anonymous code block using a DO statement.
If you need to support earlier versions of Postgres, you could, within a transaction, create a stored procedure, execute it, and delete it.
psql is just a client that you can use to interact with postgresql server. pl/pgsql is executed in the server and can be added/altered using psql (or any other client).
Maybe you find more on what you're looking for here: http://www.postgresql.org/docs/9.0/static/plpgsql.html