Using xml to run db2 commands | Unix Linux Forums | UNIX for Advanced & Expert Users

  Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Using xml to run db2 commands

UNIX for Advanced & Expert Users


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-14-2013
techy1 techy1 is offline
Registered User
 
Join Date: Sep 2012
Last Activity: 17 September 2014, 8:05 AM EDT
Posts: 51
Thanks: 6
Thanked 5 Times in 5 Posts
Using xml to run db2 commands

Hi,

Strange problem I'm having here and not sure what to do.

I have here a xml that is supposed to execute the next value in the schema but it isn't do the job it's supposed to do. I'm not a dba or a developer so I'm sorry in advance if there are some things i don't understand.
when we run the command manually in db2 it works.

Here is the code for anyone who can help:


Code:
<SOAP-ENV:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope">
<SOAP-ENV:Body>
<SQLPassthroughExecute userDomain="<DOMAIN>" userID="<UID>" workstationID="<WORKGROUP">
<SQLConnection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ID> <DBID> </ID> 
  <Name> <NAME> </Name> 
  <DriverClass>com.ibm.db2.jcc.DB2Driver</DriverClass> 
  <ConnectionURL>V7i6tNnSwrET9apffKem0fev2DgS5IaQHf2sjrmhkEFf9xaOUPiJ92gO3Rfw2F247ZToTwILWEKZPlmDSTp2t9V9dlBoGStOJxXiWVFXiezq6Ar7hauFWbx9JkbZFnlU</ConnectionURL> 
  <Password> <USERPASSWORD> </Password> 
  <Username><uid></Username> 
  </SQLConnection>
  <Statements>insert into <SCHEMA.VALUE> (ID1, ID2, ID3, ID3, ID4, ID5, ID6, ID7, ID8, ID9) VALUES (NEXT VALUE FOR <SCHEMA>.STRESS, 1349, 11, 141, 0.1, 1089, '', '<USERNAME>', CURRENT_TIMESTAMP, 0)</Statements> 
  <StatementDelimiter>|</StatementDelimiter> 
  <Transaction>true</Transaction> 
  <ContinueOnError>false</ContinueOnError> 
  </SQLPassthroughExecute>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

Sponsored Links
    #2  
Old 06-14-2013
Don Cragun's Avatar
Don Cragun Don Cragun is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 22 September 2014, 5:57 AM EDT
Location: San Jose, CA, USA
Posts: 4,677
Thanks: 180
Thanked 1,564 Times in 1,331 Posts
XML is just (structured) data. It doesn't run anything.

What application are you using to process this XML file?
Sponsored Links
    #3  
Old 06-14-2013
techy1 techy1 is offline
Registered User
 
Join Date: Sep 2012
Last Activity: 17 September 2014, 8:05 AM EDT
Posts: 51
Thanks: 6
Thanked 5 Times in 5 Posts
Quote:
Originally Posted by Don Cragun View Post
XML is just (structured) data. It doesn't run anything.

What application are you using to process this XML file?
A new vendor had given us a java application to stress test our server and from what they explained these xml's are supposed to insert into the tables. We modified one line to use the next available line.

not sure if that helps.
    #4  
Old 06-14-2013
Don Cragun's Avatar
Don Cragun Don Cragun is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 22 September 2014, 5:57 AM EDT
Location: San Jose, CA, USA
Posts: 4,677
Thanks: 180
Thanked 1,564 Times in 1,331 Posts
Quote:
Originally Posted by techy1 View Post
A new vendor had given us a java application to stress test our server and from what they explained these xml's are supposed to insert into the tables. We modified one line to use the next available line.

not sure if that helps.
Not at all. All that you have told us is that you have an XML file that you modified such that it no longer works correctly (if it ever did) when it is processed by code written in Java that you obtained from a 3rd party.

I could make a wild guess that the text marked in red below (and the spaces surrounding them) needs to be replaced by data appropriate to your environment, but with what have provided, all we can do is make wild guesses:

Code:
<SOAP-ENV:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope">
<SOAP-ENV:Body>
<SQLPassthroughExecute userDomain="<DOMAIN>" userID="<UID>" workstationID="<WORKGROUP">
<SQLConnection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ID> <DBID> </ID> 
  <Name> <NAME> </Name> 
  <DriverClass>com.ibm.db2.jcc.DB2Driver</DriverClass> 
  <ConnectionURL>V7i6tNnSwrET9apffKem0fev2DgS5IaQHf2sjrmhkEFf9xaOUPiJ92gO3Rfw2F247ZToTwILWEKZPlmDSTp2t9V9dlBoGStOJxXiWVFXiezq6Ar7hauFWbx9JkbZFnlU</ConnectionURL> 
  <Password> <USERPASSWORD> </Password> 
  <Username><uid></Username> 
  </SQLConnection>
  <Statements>insert into <SCHEMA.VALUE> (ID1, ID2, ID3, ID3, ID4, ID5, ID6, ID7, ID8, ID9) VALUES (NEXT VALUE FOR <SCHEMA>.STRESS, 1349, 11, 141, 0.1, 1089, '', '<USERNAME>', CURRENT_TIMESTAMP, 0)</Statements> 
  <StatementDelimiter>|</StatementDelimiter> 
  <Transaction>true</Transaction> 
  <ContinueOnError>false</ContinueOnError> 
  </SQLPassthroughExecute>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

Maybe someone who knows what SOAP means in this context will be able to help you.
Sponsored Links
    #5  
Old 06-14-2013
techy1 techy1 is offline
Registered User
 
Join Date: Sep 2012
Last Activity: 17 September 2014, 8:05 AM EDT
Posts: 51
Thanks: 6
Thanked 5 Times in 5 Posts
Quote:
Originally Posted by Don Cragun View Post
Not at all. All that you have told us is that you have an XML file that you modified such that it no longer works correctly (if it ever did) when it is processed by code written in Java that you obtained from a 3rd party.

I could make a wild guess that the text marked in red below (and the spaces surrounding them) needs to be replaced by data appropriate to your environment, but with what have provided, all we can do is make wild guesses:

Code:
<SOAP-ENV:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope">
<SOAP-ENV:Body>
<SQLPassthroughExecute userDomain="<DOMAIN>" userID="<UID>" workstationID="<WORKGROUP">
<SQLConnection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <ID> <DBID> </ID> 
  <Name> <NAME> </Name> 
  <DriverClass>com.ibm.db2.jcc.DB2Driver</DriverClass> 
  <ConnectionURL>V7i6tNnSwrET9apffKem0fev2DgS5IaQHf2sjrmhkEFf9xaOUPiJ92gO3Rfw2F247ZToTwILWEKZPlmDSTp2t9V9dlBoGStOJxXiWVFXiezq6Ar7hauFWbx9JkbZFnlU</ConnectionURL> 
  <Password> <USERPASSWORD> </Password> 
  <Username><uid></Username> 
  </SQLConnection>
  <Statements>insert into <SCHEMA.VALUE> (ID1, ID2, ID3, ID3, ID4, ID5, ID6, ID7, ID8, ID9) VALUES (NEXT VALUE FOR <SCHEMA>.STRESS, 1349, 11, 141, 0.1, 1089, '', '<USERNAME>', CURRENT_TIMESTAMP, 0)</Statements> 
  <StatementDelimiter>|</StatementDelimiter> 
  <Transaction>true</Transaction> 
  <ContinueOnError>false</ContinueOnError> 
  </SQLPassthroughExecute>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

Maybe someone who knows what SOAP means in this context will be able to help you.

thank you. those fields in red have been filled out, I just removed them for confidential reasons.

Sorry I'm not entirely sure how to put it in better words. I've actually never done anything like this before, I'm a sys admin but Trying to help out the team working on this.
Sponsored Links
    #6  
Old 06-14-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 16 September 2014, 1:48 PM EDT
Location: Southern NJ, USA (Nord)
Posts: 4,412
Thanks: 8
Thanked 540 Times in 518 Posts
Looks like std IBM SOAP: DB2 Database for Linux, UNIX, and Windows

It is unfortunate you used <vvv> form for removed values, since it resembles XML. It is good for man pages, which are older!

Typo'd, too. I put in obvious replacement my_* in lower case. The XML seems balanced and all that. I indented it for depth of wrapper elements:
Code:
<SOAP-ENV:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope">
<SOAP-ENV:Body>
  <SQLPassthroughExecute userDomain="my_domain" userID="my_uid" workstationID="my_workgroup">
    <SQLConnection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <ID>my_dbid</ID> 
      <Name>my_name</Name> 
      <DriverClass>com.ibm.db2.jcc.DB2Driver</DriverClass> 
      <ConnectionURL>V7i6tNnSwrET9apffKem0fev2DgS5IaQHf2sjrmhkEFf9xaOUPiJ92gO3Rfw2F247ZToTwILWEKZPlmDSTp2t9V9dlBoGStOJxXiWVFXiezq6Ar7hauFWbx9JkbZFnlU</ConnectionURL> 
      <Password>my_passwd</Password> 
      <Username>my_username</Username> 
     </SQLConnection>
    <Statements>insert into my_schema.my_table (ID1, ID2, ID3, ID3, ID4, ID5, ID6, ID7, ID8, ID9) VALUES (NEXT VALUE FOR my_schema.STRESS, 1349, 11, 141, 0.1, 1089, '', 'my_username', CURRENT_TIMESTAMP, 0)</Statements> 
    <StatementDelimiter>|</StatementDelimiter> 
    <Transaction>true</Transaction> 
    <ContinueOnError>false</ContinueOnError> 
   </SQLPassthroughExecute>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

PS: Single inserts are atomic, so a transaction is a waste. Does the insert work on the command line 'db2' with these credentials?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Assigning value of a select count(*) from tablename ( run on db2 ) to a unix variable Siddarth Shell Programming and Scripting 3 10-26-2010 12:11 AM
Run DB2 export command in loop srimitta Shell Programming and Scripting 4 08-05-2010 11:30 AM
Run a shell script from one host which connext to remote host and run the commands SN2009 Shell Programming and Scripting 6 04-13-2009 04:39 AM
Execute db2 commands in unix rollthecoin AIX 3 04-26-2008 01:17 AM
Run SQL queries in DB2 and output to file simhasuri Shell Programming and Scripting 0 01-21-2008 12:35 AM



All times are GMT -4. The time now is 10:14 AM.