Passing DB2 commands via cfquery

Hi-
Does anyone know how to pass DB2 command(s) via a cfquery?
I've been tasked with getting a SQL query into Coldfusion
that uses - what looks to me - like a native DB2 command. (The DB2
EXPORT command takes data specified from a query and writes a
formatted file.) Specifically, I need to pass a query via
<cfquery> that looks something like:
<cfquery...>
EXPORT TO file.out
OF DEL MODIFIED BY STRIPLZEROS
SELECT
select statement here
</cfquery>
I'm kinda thinking that if you know how to "escape" the
native commands in a cfquery that might work, but for now when I
pass the above query it errors out on me.
Anyone?
Thanks,
Rich

rich.leach wrote:
> Hi-
>
> Does anyone know how to pass DB2 command(s) via a
cfquery?
>
> I've been tasked with getting a SQL query into
Coldfusion that uses - what
> looks to me - like a native DB2 command. (The DB2 EXPORT
command takes data
> specified from a query and writes a formatted file.)
Specifically, I need to
> pass a query via <cfquery> that looks something
like:
>
> <cfquery...>
> EXPORT TO file.out
> OF DEL MODIFIED BY STRIPLZEROS
> SELECT
> select statement here
> </cfquery>
>
> I'm kinda thinking that if you know how to "escape" the
native commands in a
> cfquery that might work, but for now when I pass the
above query it errors out
> on me.
>
> Anyone?
>
> Thanks,
>
> Rich
In general you just pass it in, just like you tried. All the
<cfquery
...> tag is wrap everything inside it up and passes it to
the database
as the string it is.
What you very likely are running into a limitation of the
database
driver between ColdFusion and your database. It may not be
able to
handle this command and|or the type of result it returns.
Checking on
the drivers capabilities and|or alternate choices maybe
required.
Alternatively, does DB2 support some type of stored
procedure? Can you
write this code in the database and just call it with
<cfquery ...> or
<cfstoredprocedure...> tags?

Similar Messages

  • How to check fastest growing tables in db2 via db2 command

    Hi Experts,
    You might feel this very silly question on this forum, but still because of some requirement’s I need that. I'm new to db2 and basis so please bare my immatureness.
    Our DB size is growing faster @ 400/500 MB per day from last 15 days, which is supposed to be not more than 100 MB per day. We want to check the fastest growing tables. So i checked the history in db02 transaction and select the entry field as per 'Growth'. But for the given specific date it is showing nothing. Earlier we had same issue some 3 months back that time it used to display with same selection criteria.
    So I want a db2 command to execute and check the fastest growing table on database level. Please help guys. Early reply must be appreciated.
    PFA screenshot. DB version is DB2 9.7 and OS is Linux
    Thanks & Regards,
    Prasad Deshpande

    Hi Gaurav/Sriram,
    Thanks for the reply..
    DBACOCKPIT is best to go i agree with you but on DBACOCKPIT though our data collector framework and rest all the things are configured properly but still it is not working. It is not changed from last 1 year, and for same scenario 3 months ago it has displayed the growth tables.
    Any how i have raised this issue to SAP so let the SAP come back with the solution on this product error.
    In the mean while @ Experts please reply if you know the DB level command for getting the fastest growing table.
    I'll update the SAP's reply for the same as soon as i get, so that the community should also get the solution for this..
    Thanks & Regards,
    Prasad Deshpande

  • How to pass a command line argument to a jsp file...

    Hi guys,
    I'm writing a jsp file in which I have some java codes. I want to pass some command line arguments to that jsp file. In other words, I have some files located somewhere on my C drive and I want to pass the path to these files to my jsp file. How can it be done? I have never done before.
    Any suggestion will be very hepful...
    Thanks....

    I dont know if I truly understand your problem...
    For instance, when you place the url of your jsp you can add, at the end some parameters. For example:
    http://myserver/myapp/myjsp.jsp?MyParameter=C:\Temp\JavaTutorial.html
    In your JSP, you can place this code on a scriplet to get the value:
    String path = request.getParameter("MyParameter");
    Hope it helps.

  • How to run db2 command by using Runtime exec

    Hello
    I am using java. When i am runing db2 command by using Runtime.exec( String cmd, String[] env ). I gave the environment path
    DB2CLP=6259901
    DB2DRIVER=D:\ibm\db2\java\db2java.zip
    DB2HOME=D:\ibm\db2
    DB2INSTANCE=DB2
    DB2MMTOP=D:\CMBISS
    but still I am getting error message
    "DB21061E Command line environment not initialized"
    after setting the above path in the cmd It is working fine. When i am trying thro java programm i am getting the above error. Can I get answer for this.
    bhaski.

    Before you can execute DB2 commands you have to open a DB2 CLP. The following code will do so:
    import java.io.IOException;
    public class Db2 {
         public static void main(String args[]) {
              try {
                   Runtime rt = Runtime.getRuntime();
                   Process child = rt.exec("db2cmd");
                   child.waitFor();
              catch (IOException io) {
                   io.printStackTrace();
              catch (InterruptedException e) {
                   e.printStackTrace();

  • Pass dynamic Command line arguments

    Hi,
    I tried to pass dynamic command line argument to Web start using the method :
    "javaws URL -D foo -D bar"
    as explained in the "Unofficial JWS/JNLP FAQ" that " You can pass your own system properties to your app using -D switch ....", but I got the following error at the start;
    error occurred while launching/running the application.
    Category: Invalid Argument error
    Too many arguments supplied: {http://...URL/my.jnlp, -Did=123 }
    p.s. I already added the"<property name='' value=''/> in the <resourse>, and modified the main class to get the parameter using System. getProperty();
    Did anyone try to this method before? What's wrong of this?
    Thanks in advance for your help.

    Thanks.
    here below is the jnlp file:
    <jnlp spec="1.0+" href="$$name" codebase="$$codebase">
    <information>
    <title>GUI Application</title>
    <vendor>PS</vendor>
    <description>PS GUI WebStart Version</description>
    <icon href="logo.jpg" />
    <offline-allowed />
    </information>
    <resources>
    <j2se version="1.3" />
    <jar href="lib/gui.jar" />
    <property name="id" value="zbc" />
    <jar href="lib/classes12.zip" />
    <jar href="lib/j2ee.jar" />
    <jar href="lib/jaas.jar" />
    <jar href="lib/jce1_2_1.jar" />
    <jar href="lib/jdom.jar" />
    <jar href="lib/xerces.jar" />
    <jar href="lib/local_policy.jar" />
    <jar href="lib/log4j.jar" />
    <jar href="lib/orion.jar" />
    <jar href="lib/sunjce_provider.jar" />
    <jar href="lib/US_export_policy.jar" />
    </resources>
    <security>
    <all-permissions />
    </security>
    <application-desc main-class="GUIFrame">
    </application-desc>
    and in the main class "GUIFrame", i use System.getProperty("id") t get the parameter, if I hardcode the value of the "id" in this jnlp file and use javaws URL, everything's fine, but not the "javaws URL -Did=value" which will return the error as mentioned.
    Thanks again for your help.

  • Is there now a system call to send pass-through commands to ATA devices?

    I want to send pass-through ATA commands to SATA/ATA devices on intel-based solaris. From the beginning the USCSICMD ioctl has worked just fine on SCSI/SAS/FC targets on intel & sparc-based solaris, but the mechanism to send pass-through commands to ATA devices has always been undocumented, closed, unavailable, whatever.
    Is there now a way to do this w/o writing a custom device driver? Does anybody have an example chunk of code that does something simple like send the ATA IDENTIFY command to a disk drive? I know I can use SATL to encapsulate commands to SATA disks using certain SAS controllers, but I really need a way that will work with devices that are plugged into a standard SATA port on a motherboard.
    Thanks

    Hi Dhalek,
    Just tried out a small example and it works ok in SQL Dev 4
    drop table t1;
    create table t1 (col1 int);
    insert into t1 values (1);
    insert into t1 values (2);
    insert into t1 values (3);
    select * from t1;
    /*sqldev:stmt*/BEGIN;
    DELETE FROM t1;
    SELECT * FROM t1;
    /*sqldev:stmt*/ROLLBACK;
    SELECT * FROM t1;
    ---- RESULT ----
    table T1 dropped.
    table T1 created.
    1 rows inserted.
    1 rows inserted.
    1 rows inserted.
    col1      
    1         
    2         
    3         
    /*sqldev:stmt*/BEGIN
    3 rows deleted.
    col1      
    /*sqldev:stmt*/ROLLBACK
    col1      
    1         
    2         
    3        
    Regards,
    Dermot
    SQL Developer Team

  • Problem with issuing command via CustomScriptExtension

    I am trying to issue a CustomScriptExtension command to an Azure virtual machine from within my C# application. The CustomScriptExtension is installed in the VM and working. I verified this by issuing a test command via PowerShell. Essentially I am trying
    to execute what would be the equivalent to the PowerShell command Set-AzureVMCustomScriptExtension, but in code.
    Below is the code segment that I am having problems with:
    ComputeManagementClient client = new ComputeManagementClient(AzureSessionInfo.CloudCredentials);
    IList<ResourceExtensionReference> extReferences = new List<ResourceExtensionReference>();
    IList<ResourceExtensionParameterValue> extParamValues = new List<ResourceExtensionParameterValue>();
    string account = "{\"storageAccountName\":\"" + AzureSessionInfo.StorageAccount + "\",\"storageAccountKey\": \"" + AzureSessionInfo.StorageAccountKey + "\"}";
    string scriptfile = "{\"fileUris\": [\"" + "https://teststorageaccount.blob.core.windows.net/testcontainer" + "\"], \"commandToExecute\":\"powershell -ExecutionPolicy Unrestricted -file " + "ScriptName.ps1" + "\"}";
    byte[] bytes1 = System.Text.Encoding.UTF8.GetBytes(account);
    bytes1 = System.Text.Encoding.UTF8.GetBytes(account);
    string ScriptPrivateConfig = Convert.ToBase64String(bytes1);
    byte[] bytes2 = System.Text.Encoding.UTF8.GetBytes(scriptfile);
    bytes2 = System.Text.Encoding.UTF8.GetBytes(scriptfile);
    string ScriptPublicConfig = Convert.ToBase64String(bytes2);
    ResourceExtensionParameterValue extRef_Parameter1 = new ResourceExtensionParameterValue()
    Key = "CustomScriptExtensionPrivateConfigParameter",
    Value = ScriptPrivateConfig,
    Type = "Private"
    ResourceExtensionParameterValue extRef_Parameter2 = new ResourceExtensionParameterValue()
    Key = "CustomScriptExtensionPublicConfigParameter",
    Value = ScriptPublicConfig,
    Type = "Public"
    extParamValues.Add(extRef_Parameter1);
    extParamValues.Add(extRef_Parameter2);
    ResourceExtensionReference extRef_CustomScript = new ResourceExtensionReference
    Name = "CustomScriptExtension",
    Publisher = "Microsoft.Compute",
    Version = "*",
    ReferenceName = "CustomScriptExtension",
    ResourceExtensionParameterValues = extParamValues
    extReferences.Add(extRef_CustomScript);
    AzureSessionInfo.CloudServiceName = "CS1000001";
    AzureSessionInfo.VMName = "CS1000001";
    AzureSessionInfo.ImageFamilyName = "Windows Server 2012 R2 Datacenter";
    client.VirtualMachines.Update(AzureSessionInfo.CloudServiceName,
    AzureSessionInfo.VMName,
    AzureSessionInfo.VMName,
    new VirtualMachineUpdateParameters
    RoleName = AzureSessionInfo.VMName,
    ResourceExtensionReferences = extReferences
    I receive the following error message back from the call:
    BadRequest: Invalid extension reference parameter value in JSON configuration data for the Role: CS1000001, Reference name: CustomScriptExtension.
    I could only find very little documentation on this. Any help would be appreciated.

    Thanks Mekh... after many hours of researching and trial/error, I figured it out.
    The MSDN article I used previously led me down the wrong path. (see article here: http://msdn.microsoft.com/en-us/library/azure/dn781373.aspx). This may work for RESTful calls but not for .NET API calls.
    The part of the code that was hurting me was where the command strings (account and
    scriptfile) were being converted to Base64 encoding. This is NOT correct for .NET calls. Once I removed that, everything worked fine.
    I came across this after researching the same commands used by Linux scripts. They don't convert to Base64 either so I wonder why this is included in the documentation at all.
    In either case, I figured it out, but the documentation is very poor in this area (or all together non-existent). I don't even see where it is documented as to which JSON parameters names are supposed to be used, or even that JSON is required.
    Also, related to the Update command, if you are truly "updating" the config, you must include everything about the original config (whether it changed or not) along with the changes you want to make. If not then you will undo ALL but the changes
    you issued via the command.

  • Passing a command to another applicatio​n using Labview

    Hi All,
    I have a query. I am using two softwares for my experiment. I am calling coboldpc from Labview. What I need to do is when I call cobold pc from Labview, as soon as coboldpc opens it should start executing new.ccf file. I am able to call coboldpc from labview . How can I pass a command 'execute new.ccf' to coboldpc by using Labview! Thanks a lot in advance to the person who has answer to this.
    Maithili

    I do not know what do you exactly mean by this! I tried to execute coboldpc application through dos prompt and also to pass the command. It works fine with document file but not with an executable file. Coboldpc has a command line where I think I need to pass the command.
    I am trying for one more option to work this out. I am trying to call coboldpc dll through labview. Actualy it i staking time to study those dlls written by someone else. I am not getting much of it. Do you have any idea by any way how can it become easier to use this option!
    Thanks ,
    Maithili

  • Running a db2 command from Java Application ??

    Hi All,
    I have to write an application in JDBC that can retrieve a list of databases on a db2 server, the only way I know is the db2 command "list database directory", but I can not use it in a JAVA program, is there a solution for this?
    Can anyone help me in this regard ?
    Thanks in Advance.

    If your driver implement it you can list databases with DatabaseMetaData
    Connection conn = ...
    DatabaseMetaData meta = conn.getMetaData();
    ResultSet rs = meta.getCatalogs();
    while (rs.next())
        System.out.println(rs.getString("TABLE_CAT"));
    }

  • Pass the command line argument (argc and argv) to a LabVIEW built shared library.

    Hello,
    I have successully use this trick to build a LabVIEW application that runs on Linux without X Display.
    http://digital.ni.com/public.nsf/allkb/5D6EC36DCF43343786257449006919E6
    I'd like to know if it's possible to pass the command line arguments ( ./TEST A B C D) directly into the shared library without having to pass the arguments using a array of strings which would require to write code using DSNewHandle, DSSetHandleSize, extract the arguments and ..... (I'm not proficient in C, but if I don't have a choice I will do it and improve my C skills).
    int main(int argc, char *argv[])
            Test(argc, argv);
            return 0;
    Thanks,
    Michel
    Solved!
    Go to Solution.

    Well, you can always flatten it back into a space separated single string and pass it like that. Basically reverse what the OS does when it calls your main function with the command line parameters. And while the first element in the array is always the program name itself you can just skip that here, but then format all the rest into a single string.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Db2 command for create tablespaces of DB2 V9.1.3

    Dear All,
    Currently, I’ve run prepare for upgrade SAP form 4.6C/DB2 9.1.3 to ECC6.
    But, I don’t know to db2 command for create tablespaces as below.
    Could you please example the DB2 command for create tablespaces as below.
    ERROR> Insufficient free space in the database as follows:
    Please refer to file DBFPLUSD.RES for more details and dditional  information about the results of the free space check on DB6 !!!
    ERROR> Create tablespace PSAPDIMD with 120 MB
    ERROR> Create tablespace PSAPDIMI with 120 MB
    ERROR> Create tablespace PSAPODSD with 130 MB
    ERROR> Create tablespace PSAPODSI with 130 MB
    ERROR> Create tablespace PSAPFACTD with 120 MB
    ERROR> Create tablespace PSAPFACTI with 120 MB
    ERROR> Create tablespace PSAPEL700D with 420 MB
    ERROR> Create tablespace PSAPEL700I with 220 MB
    ERROR> Create tablespace PSAPES700D with 21290 MB
    ERROR> Create tablespace PSAPES700I with 5420 MB
    Thanks in advance
    Regards,
    Jaturong P.

    Hi,
    During the PREPARE phase normally it creates a script which you can run for the creation of these Tablespaces,this script can be found in the Upgrade directory(eg:/usr/sap/put/log/DB6TBSXT.CLP - this script will have the command to create the tablespaces).Just run this script,it will create all the tablespaces based on the requirement.
    Regards,
    Sam
    Edited by: Cheriyan Sam on Apr 22, 2008 9:12 AM

  • Gpib commands via ethernet

    how can i control my device through ethernet by passing SCPI commands or GPIB commands.
    The device is standalone industrial PC has laser sources.I need to control sources. The IP address is 202.10.10.2.

    You can use VISA to control an instrument with an ethernet interface. Open a connection using a resource name of TCPIP::host address and then you should be able to send your SCPI commands with VISA Write just like you would with a GPIB connection. You should also verify that it's on the LAN from MAX. Right click on Devices and Interfaces, select Create New and then select TCP/IP Resource and then follow the directions.

  • How to pass DOS command

    I am trying to use Java to pass DOS command to command prompt. Can anyone give me some idea on how to do that?

    Runtime.getRuntime().exec("docommand here");

  • Total nube to jws, need to run ssh command via web or jws?

    Ok So we had a developer that created this application that can basically run ssh commands via jws I believe. Unfortunately he is no longer here. I am wondering how you do this? I know tha commands that are already set up, but I have no idea how to implement it into my project.
    I am using Struts 2, Java 5, Weblogic 9.2, Spring
    Thanks
    orozcom

    Have a look at:
    http://www.jcraft.com/jsch/
    basically you'd need a small webstart client to wrap something like the above library. Best thing is to try with a standalone java client first. Once that is working have a look at turning it into a webstart app.

  • Can not send command via VISA test panel in MAX

    Hello all,
    I am having a small issue using the VISA test panel in MAX.  I am trying to send a simple command to a device and then retrieve the response data.  I am able to do this successfully via Labview, but for whatever reason I can not get a good response in MAX.  The command that I am sending is simply a letter (address of the device) followed by an end of line character (\r\n in ascii).  In MAX, I simply append the \r\n onto the string sent in the buffer (Send End on Writes == FALSE).  All serial settings are the same as what I have in LV (19.2, 8-n-1).  Does anyone have any thoughts?  This is kind of frustrating as I just want to do something simple and don't want to have to build a whole routine in LV to do this.
    Cheers, Matt
    Matt Richardson
    Certified LabVIEW Developer
    MSR Consulting, LLC
    Solved!
    Go to Solution.

    Thanks, Broken.  I am getting a time out error.  Clearing the buffers doesn't seem to be making a difference. This is baffling to me.  I must be missing something fundamental.
    Something that I didn't add before is that I seem to be able to send the command via labview without a read, and then read it via MAX.  This must have something to do with way it is sending the command.  Arrrrgh!
    Matt
    Matt Richardson
    Certified LabVIEW Developer
    MSR Consulting, LLC

Maybe you are looking for

  • Creation of ASM disk for OUI

    I need to install a Oracle Database in order to install Enterprise Manager Cloud Control 12c. Need the database to use a ASM disk. I used the following command to create the disk, per the Oracle Database Installation Guide. #/usr/sbin/oracleasm creat

  • Bug in Mail's handling of missing font for creating a "Note"

    I try to keep my font library trimmed down to a minimum, since i don't use many fonts, and don't like to see cluttered font menus. However I apparently disabled one too many fonts, and now Mail refuses to create "notes". When I go to create a new not

  • How to delete Client of SAP_ALL  profile

    I have make one client 800 in sap with SAP_ALL profile . now I want to delete this client because my harddisk space is going to Full. How I will delete Client 800 . So that my Harddisk should be free space.Please tell me step by step Thanks & Regards

  • IPad air Smart Cover not aligning properly

    Is anyone else having issues? My nice new iPad air arrived on Tuesday, 3 days latter I received my apple Smart Cover! Why not send them together? That's another storey. After a days use, I notice that the cover is not aligning properly, then I read o

  • Only some pictures are uploading from icloud

    I recently replaced my old iPhone (the top button had been stuck) and when I got my new phone, all the pictures I had from my photostream had been uploaded onto my phone. Recently this new phone has been glitching and all my pictures have been delete