I need to change the CONNAME('xx.xx.xxx.xx(1414) to CONNAME('yy.yy.yyy.yy(1414) for IBM MQ. I searched through the internet I did not found any command. My object definition code is given below.
DEFINE CHANNEL(CHANNELNAME) +
CHLTYPE(SDR) +
TRPTYPE(TCP) +
MAXMSGL(30000000) +
DESCR('Channel to REPLY TO sender') +
XMITQ('Sender.XMITQ') +
CONNAME('xx.xx.xxx.xx(1414)') +
BATCHSZ(50) +
DISCINT(6000) +
SHORTRTY(10) +
SHORTTMR(60) +
LONGRTY(999999999) +
KAINT(AUTO) +
LONGTMR(1200) +
SEQWRAP(999999999) +
CONVERT(YES) +
MCATYPE(PROCESS) +
HBINT(300) +
BATCHINT(0) +
NPMSPEED(FAST)
Can I use the ALTER command? if I delete the channel and redefine it will it cause any problem to existing channels and queues?
You can use the ALTER CHANNEL command like this:-
ALTER CHANNEL(CHANNELNAME) CHLTYPE(SDR) CONNAME('yy.yy.yyy.yy(1414)')
You only need to supply the attributes that you need to change, plus always the CHLTYPE.
You don't need to DELETE and re-DEFINE the channel object, and doing so would cause the run-time state such as channel sequence numbers to get out of step.
Additional Reading
ALTER CHANNEL reference documentation
Related
I want to read bas queue names inside the queues, have written code but which only able to read the last queue name instead of all.
Below is a code
queueList = AdminConfig.list('MQQueue', AdminConfig.getid('/Cell:' + AdminControl.getCell() + '/')).splitlines()
for queue in queueList:
print "\t" + queue +"in QueueList"
queueName = AdminConfig.showAttribute(queue, 'baseQueueName')
print queueName
The queue is reading only the last queue name from queueList, I want it to read all the base queue names present inside queues.
Your script as currently written will only execute the following line for each queue in the queueList:
print "\t" + queue +"in QueueList"
You need to indent the last 2 lines to make them part of the for loop, otherwise they are only executed once after the loop is finished, at that point queue will have the value of the last queue.
queueList = AdminConfig.list('MQQueue', AdminConfig.getid('/Cell:' + AdminControl.getCell() + '/')).splitlines()
for queue in queueList:
print "\t" + queue +"in QueueList"
queueName = AdminConfig.showAttribute(queue, 'baseQueueName')
print queueName
I try to test the jdbc connection of snowflake with codes below
Connection conn = .......
.......
ResultSet rs = conn.getMetaData().getColumns(**null**, "PUBLIC", "TAB1", null); // 1. set parameters to get metadata of table TAB1
while (rs.next()) { // 2. It hangs here if the first parameter is null in above liune; otherwise(set the corrent db name), it works fine
System.out.println( "precision:" + rs.getInt(7)
+ ",col type name:" + rs.getString(6)
+ ",col type:" + rs.getInt(5)
+ ",col name:" + rs.getString(4)
+ ",CHAR_OCTET_LENGTH:" + rs.getInt(16)
+ ",buf LENGTH:" + rs.getString(8)
+ ",SCALE:" + rs.getInt(9));
}
.......
I debug the codes above in Intellij IDEA, and find that the debugger can't get the details of the object, it always shows "Evaluating..."
The JDBC driver I used is snowflake-jdbc-3.12.5.jar
Is it a bug?
When the catalog (database) argument is null, the JDBC code effectively runs the following SQL, which you can verify in your Snowflake account's Query History UIs/Views:
show columns in account;
This is an expensive metadata query to run due to no filters and the wide requested breadth (columns across the entire account).
Depending on how many databases exist in your organization's account, it may require several minutes or upto an hour of execution to return back results, which explains the seeming "hang". On a simple test with about 50k+ tables dispersed across 100+ of databases and schemas, this took at least 15 minutes to return back results.
I debug the codes above in Intellij IDEA, and find that the debugger can't get the details of the object, it always shows "Evaluating..."
This may be a weirdness with your IDE, but in a pinch you can use the Dump Threads (Ctrl + Escape, or Ctrl + Break) option in IDEA to provide a single captured thread dump view. This should help show that the JDBC client thread isn't hanging (as in, its not locked or starved), it is only waiting on the server to send back results.
There is no issue with the 3.12.5 jar.I just tested the same version in Eclipse, I can inspect all the objects . Could be an issue with your IDE.
ResultSet columns = metaData.getColumns(null, null, "TESTTABLE123",null);
while (columns.next()){
System.out.print("Column name and size: "+columns.getString("COLUMN_NAME"));
System.out.print("("+columns.getInt("COLUMN_SIZE")+")");
System.out.println(" ");
System.out.println("COLUMN_DEF : "+columns.getString("COLUMN_DEF"));
System.out.println("Ordinal position: "+columns.getInt("ORDINAL_POSITION"));
System.out.println("Catalog: "+columns.getString("TABLE_CAT"));
System.out.println("Data type (integer value): "+columns.getInt("DATA_TYPE"));
System.out.println("Data type name: "+columns.getString("TYPE_NAME"));
System.out.println(" ");
}
I'm trying to get a bot to "click" a button on an interactive message in Slack (preferably as a bot, but using a user token works too).
I've found that the link to send the action information to be
https://blue-hybrid.slack.com/api/chat.attachmentAction
My problem is I can't find any documentation for "chat.attachmentAction." Looking at the request sent when using my browser, it has one http argument: "_x_id" and the payload is a WebKitForm, containing 4 items: payload, client_id, payload_id, and token.
I'm sure if I'm just not sending the appropriate data or authentication or what. All of my POSTs return "invalid_payload" or "invalid_arg_name."
Any help is greatly appreciated.
Looks like I figured it out, finally!
I had to work it out the old fashioned way. Slack Customer Support would only help with the official public API. I'll leave the solution here in Javascript.
To do this, you need 3 things:
choice_num
the number of the choice within the list of options.
e.g. If a message has the buttons (from left to right): yes, no, and maybe, then yes=0, no=1 and maybe=2.
message
the json of the interactive message
SLACK_TOKEN
your slack token (not sure if bot tokens work, user tokens do however)
The method chat.attachmentAction itself requires 3 arguments:
payload
service_id AND/OR bot_user_id
token
args = encodeURI(
'payload={'
+ '"actions":[' + JSON.stringify(message.attachments[0]["actions"][choice_num]) + '],'
+ '"attachment_id":"' + message.attachments[0]["id"] + '",'
+ '"callback_id":"' + message.attachments[0]["callback_id"] + '",'
+ '"channel_id":"' + message.channel + '",'
+ '"message_ts":"' + message.ts + '"}'
+ '&service_id=' + message.bot_id
+ '&bot_user_id=' + message.user
+ '&token=' + SLACK_TOKEN
)
request_url = 'https://YOURSLACKTEAM.slack.com/api/chat.attachmentAction?' + args
then just send an async POST to the request_url and you should get back something like this:
{"replaced":true,"ok":true}
Here are Jmeter script structure:
Test Plan
+ User Defined Variables
+ - votes_id: ${__P(votes_id,${__Random(11,14)})}
+ ...
+ Thread Group
+ + Throughput Controller1
+ + + Http Request1
+ + Throughput Controller2
+ + + Http Request2
+ + Throughput Controller3
+ + + Http Request3
+ + + Http Request4
+ + + - paramater1:${votes_id}
Issue: http request only send with the same num.
when set paramater1:${__Random(11,14)}, it works with random number from 11 to 14.
Note: I have also try components CSV Data Set Config. when I disable Throughput Controller1, Throughput Controller2, Http Request4 works with multi number.
How can I use CSV Data Set Config to send request parameter with random number?
Thanks.
As per Where can functions and variables be used? chapter:
Functions and variables can be written into any field of any test component
As per What can functions do
Functions are shared between threads. Each occurrence of a function call in a test plan is handled by a separate function instance.
So you basically don't need to define a variable, you can use __Random() function directly in the HTTP Request parameter section
Test Plan
+ ...
+ Thread Group
+ + Throughput Controller1
+ + + Http Request1
+ + Throughput Controller2
+ + + Http Request2
+ + Throughput Controller3
+ + + Http Request3
+ + + Http Request4
+ + + - paramater1:${__P(votes_id,${__Random(11,14)})}
This way the function will be evaluated individually by each thread hence you will get a new value each time the function will be called.
Check out Apache JMeter Functions - An Introduction to learn more about JMeter Functions concept.
Don't use User Defined Variables for other then initial values:
Note that all the UDV elements in a test plan - no matter where they
are - are processed at the start.
UDVs should not be used with functions that generate different results
each time they are called. Only the result of the first function call
will be saved in the variable. However, UDVs can be used with
functions such as __P()
For defining variables during a test run, see User Parameters. UDVs
are processed in the order they appear in the Plan, from top to
bottom.
UseUser Parameters and put it as Pre processor child of HTTP request. It'll be called every time.
I'm writing a little java program to write data in a AS/400 DB2 table via jdbc (db2jcc.jar version 1.0.581) and a trigger is associated to the INSERT operation. This trigger works on various tables associated with libraries different from that (jdta73p10) which contains my table (f4104).
Follows the code I use to establish connection and read data that perfectly runs.
import java.sql.*;
import com.ibm.db2.jcc.*;
public class ProvaNUMEAN13 {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
DB2DataSource dbds = new DB2DataSource();
dbds.setDriverType(4);
dbds.setServerName("a60d45bb");
dbds.setPortNumber(446);
dbds.setDatabaseName("prodgrp");
dbds.setDescription("Prova collegamento");
dbds.setUser("XXXXX");
dbds.setPassword("XXXXX");
Connection con = dbds.getConnection();
Statement stmtNum = con.createStatement();
stmtNum.executeQuery("select * from INTERFACCE.NUMEAN13");
ResultSet rs = stmtNum.getResultSet();
rs.next();
System.out.println("Valore numeratore: " + rs.getString("E13EAN"));
System.out.println("Tipo numeratore: " + rs.getString("K13KEY"));
stmtNum.close();
Statement stmtAnag = con.createStatement();
stmtAnag.executeQuery("select * from jdta73p10.f4101lb where IMLITM = " + "'" + args[0] + "'");
ResultSet rsAna = stmtAnag.getResultSet();
int idCodice = 0;
if (!rsAna.next()) {
System.out.println("Il codice " + args[0] + " non esiste in anagrafica!");
} else {
idCodice = rsAna.getInt("IMITM");
System.out.println("idCodice per " + args[0] + ": " + Integer.toString(idCodice));
Statement stmtQEAN = con.createStatement();
stmtQEAN.executeQuery("select IVALN, IVCITM, IVLITM, IVDSC1 from jdta73p10.f4104 where IVXRT = 'B ' and IVALN = '8000000000000'");
ResultSet rsQEAN = stmtQEAN.getResultSet();
if (rsQEAN.next()) {
System.out.println("Codice EAN per " + args[0] + " giĆ presente: " + rsQEAN.getString("IVALN"));
System.out.println("Valore EAN13: " + rsQEAN.getString("IVCITM"));
System.out.println("Risultato ricerca per EAN13: " + rsQEAN.getString("IVLITM")+" - "+rsQEAN.getString("IVDSC1"));
}
}
}
}
Problem is when I try to execute an INSERT operation (like that below); an error is generated in AS/400 due to trigger execution.
stmtQEAN.execute("insert into jdta73p10.f4104 (IVXRT,IVITM,IVCITM,IVDSC1,IVALN,IVLITM) values ('B ','18539','8000000000000','Prodotto PROVA','8000000000000','ABABABAB')");
This is the error AS/400 side:
Message ID . . . . . . : RNQ0211 Severity . . . . . . . : 99
Message type . . . . . : Inquiry
Date sent . . . . . . : 08/01/15 Time sent . . . . . . : 10:01:31
Message . . . . : Error occurred while calling program or procedure
*LIBL/PRHWRAPUSE (C G D F).
Cause . . . . . : RPG procedure TRG_F4104A in program INTERFACCE/TRG_F4104A at
statement 152 attempted to call program or procedure *LIBL/WS_MATERI, but
was unable to access the program or procedure, the library, or a required
service program. If the name is *N, the call was a bound call by procedure
pointer.
Recovery . . . : Check the job log for more information on the cause of the
error and contact the person responsible for program maintenance.
Possible choices for replying to message . . . . . . . . . . . . . . . :
D -- Obtain RPG formatted dump.
S -- Obtain system dump.
My question is: how can I specify the other libraries that trigger need? In a old version of my tools (written in Delphi) I used the Client/Access ODBC where there was a special field where you can enter additional libraries but now I don't know how to do.
AS400 (iSeries) allows a comma-separated library list in the jdbc url:
jdbc:as400://someserver;naming=system;libraries=devfiles,prodfiles,sysibm,etc
naming=system indicates sql will use a library list. For example:
select * from NUMEAN13
naming=sql indicates that sql will contain library name prefixed in table references. For example:
select * from INTERFACCE.NUMEAN13
My experience is that you can't mix them. If you use library list (naming=system), then all sql must not contain library names. If you use non library list (naming=sql), then all sql must contain the library names.
There are several ways to handle this. The user profile has a job description and that job description has a library list. I would set up a user profile / job description combination for your JDBC connexion.
If that isn't dynamic enough, consider writing a stored procedure that you can call which will set the library list the way you need it.
Another way is probably too inflexible but I mention it as an alternative. Instead of using *LIBL for the service program, specify the library. On the one hand this makes it impossible to use the same program in test and production. On the other hand, it makes it impossible for someone to insert their own library in the middle.
If you are really stuck and no one on the IBM side is able to make changes for you, you can CALL QCMDEXC as a stored procedure and alter the library list yourself, from the client. This is the least desirable because it means tight coupling between the client and server. If the IBM team ever trues to set up a test environment (or disaster recovery environment!) you will have to change all the references in your client code and distribute the changes to everyone using it.
Thank you for the tips.
I also was thinking to use a stored procedure (as you suggest) but in the end I discovered that using an other IBM package, jt400.jar, is available a DataSource class with a method to set a list of AS/400 libraries that you need to use.
Below how I modified my code (that now works!) using the method setLibraries.
import com.ibm.as400.access.*;
...
AS400JDBCDataSource dbds = new AS400JDBCDataSource();
dbds.setServerName("a60d45bb");
// dbds.setPortNumber(446);
dbds.setDatabaseName("prodgrp");
dbds.setDescription("Prova collegamento a numeratore EAN13");
dbds.setUser("XXXXX");
dbds.setPassword("XXXXX");
dbds.setLibraries("JCOM73P10 JDTA73P10 KLDADBFER KLDADBGAM INTERFACCE SAP");
Connection con = dbds.getConnection();
This class has not available the method setPort but if you use the standard port (like in my case) there are no problems. If will be necessary I'll try to discover how to set it.
Couple solutions.
quick real time fix
Copy the trigger program to QGPL (Temporary fix. A permanent fix would need to be implemented ASAP)
or
Change the JOBD of the user profile used to connect to the AS400 so it has the correct list. The user profile used for JDBC should already be locked down or it's the jdbc of a user in a group so this is a simple CHGJOBD JOBD(x) LIBL(xxx xxx xxx xxx) but the connections will have to be recycled.
or
Change the trigger program so that it has a hard coded library. I'd bet you'd need exclusive access to the file though. I'm not working (no access to iseries) so I can't verify this solution.
I recommend against changing the connection string. You'll end up having to change it for every machine that connects to the database.