Transform the query inside cfscript to not access java objects

When I downloaded my page, now my Web host says my questions to access java objects is not allowed. I can't find out how to change these queries, so that they do not use a java object.

This is one of my questions. My other questions are in the same format:

objFactory1 = CreateObject(
"java",
"coldfusion.server.ServiceFactory"
);

// Get the Data Source service from the service factory.
objDataService1 = objFactory1.DataSourceService;

// The data service object has access to all data sources
// running on the server. Let's get a connection to our
// datasource before running the query.
objDataSource1 = objDataService1.GetDataSource(
"myapp"
);

// Open the connection. Here, we have the option to pass
// in a username and password. Since I am on the dev
// server, no need to do so.
objConnection1 = objDataSource1.GetConnection(
// USERNAME, PASSWORD if needed //
dsnlogin,dsnpwd);

// Prepare the SQL statement that you want to run. Much
// harder than the CFQuery tag, but not impossible.
getevents = objConnection1.PrepareStatement(
"SELECT " &
"dtstamp, " &
"eventname " &
"FROM " &
"events " &
"WHERE MONTH(DATE(dtstamp)) = " & CurMonth & " AND DAYOFMONTH(DATE(dtstamp)) = " & i
);

// of object that we are all used to working with.
getevents = CreateObject(
"java",
"coldfusion.sql.QueryTable"
).Init( getevents.ExecuteQuery() );

// Close the connection.
objConnection1.Close();

I'm back the columns like this: getevents.eventname [intRow]

I think I got it. Here is the solution for anyone who runs into the same problem

q = new Query();

q.setDatasource( "myapp" );

// build the SQL statement
//q.setSQL( "SELECT eventname FROM events WHERE MONTH(DATE(dtstamp)) =  :themonth AND DAYOFMONTH(DATE(dtstamp)) = :theday" );

q.addParam( name="themonth", value=#curmonth#, cfsqltype="CF_SQL_INTEGER" );
q.addParam( name="theday", value=#i#, cfsqltype="CF_SQL_INTEGER" );

// run the query and get a query object
getevents = q.execute(sql="SELECT * FROM events WHERE MONTH(DATE(dtstamp)) =  :themonth AND DAYOFMONTH(DATE(dtstamp)) = :theday").getResult();    

Loop over the query results

for (
intRow = 1 ;
intRow LTE getevents.RecordCount ;
intRow = (intRow + 1)
)

{
getevents.eventname[intRow]

}

Not as difficult as I thought, just REALLY long to find the solution.

Tags: ColdFusion

Similar Questions

  • Bezier Motion 5.0.7 masks appear in the timeline panel, but in the column of layers only. This started happening yesterday. The query projects previously do not have this problem. I can't change if masks appear in the timeline panel.

    Motion 5.0.7 memory 8 GB, processor 2.93 GHz intel Core i7, ATI Radeon HD 5750 1024 MB graphics

    Bezier masks do not appear in the timeline, preventing me from editing. The masks appear in the column of layers only. The problem just started yesterday. The query projects previously do not seem to be performed.

    In the upper right corner of the canvas, there is a view menu. Check if the 'lines' are checked in the section view overlays.

  • InDesign on Mac Lion CS6 - cursor froze on the spot tool. Can not access other tools! Help please!

    InDesign on Mac Lion CS6 - cursor froze on the spot tool. Can not access other tools! Help please!

    I restarted CS6, and I can not yet anything the page. In the average operating system rush job ;(

    [Moved from the living room Forum to forum specific program... MOD]

    Thank you Michael. I will remember that if this happens again. In the end, it fixed itself! After an hour or two of hand frozen, I left for a while and when I got back, everything was very good! I think that there is a first time for everything!

  • Whenever I try to install and update creative cloud, he's going to halfway and stop the download says "Setup could not access the critical file (error code46).

    Whenever I try to install and update creative cloud, he's going to halfway and stop the download says "Setup could not access the critical file (error code46).

    Hello

    Please refer to the instructions mentioned in the link below, it should help:

    Cannot install Creative cloud installation - error code 46

    "Setup could not access a critical file. Please try to reinstall. (error code: 46) »

    Stop creating cloud download

    Let us know if this was helpful.

    Kind regards

    Bani

  • Refuse the selected inside address for internet access

    What is the best way to deny IP selected inside the addresses (PCs) access to the internet router in a PIX 506? Thank you

    Lori a

    Just use an ACL on your inside interface like so (this arretera.100 et.101 hosts out):

    > access-list out refuse host ip 192.168.1.100 everything

    > access-list out refuse host ip 192.168.1.101 everything

    > outgoing access-list allow ip 192.168.1.0 255.255.255.0 any

    > Access-group out in the interface inside

    In addition, you can change the following:

    > global (outside) 1 205.238.220.19 - 205.238.220.22

    > nat (inside) 1 0.0.0.0 0.0.0.0 0 0

    TO:

    > global (outside) 1 205.238.220.19 - 205.238.220.21

    > global (outside) 1 205.238.220.22

    > nat (inside) 1 0.0.0.0 0.0.0.0 0 0

    cause what you will allow only 4 outgoing sessions, only one user can use up to go to a web page. The second version will be PAT connections using the adresse.22, which will give you a 65 000 or if additional connections coming out.

  • I need assistance with lightroom 4 - I downloaded the software but I can not access

    I need assistance with lightroom 4 - I downloaded the software but I can't access it. I have windows XP I need to upgrade to windows vista or windows 7? Any help please. Thanks Zara

    Lightroom 4 does not work on Windows XP

    http://www.Adobe.com/products/Photoshop-Lightroom/tech-specs.html

    You will need to upgrade to Windows 7 or Windows 8. Avoid Vista - It's terrible.

  • The Windows Installer service could not access while trying to install Skype

    They advised me to contact my support staff to verify that Windows Installer service is properly registered.  I don't know which is referenced support staff.  Help, please.

    Hello

    Follow this article troubleshooting methods to resolve the problem.

    Problems installing and uninstalling programs on Windows computers

    See also: error message when you try to add or remove a program on a computer that is running Windows XP or Windows Server 2003: "the Windows Installer service is not to be accessible"

  • I am the administrator of the computer and forgot my password. I followed the tip and still can not access my account, I can't just remember or find the place where to get my account

    Please help I just took my old computer out of my 6 years ago storage unit. I forgot my password. or the administrator of the computer. I took the trick and I tried every way I can think of, but still cannot access it. What should I do or where do I go for the info access into something. It's my other computer that's how I got to ask this question.

    Hello

    This is information from Microsoft for when you forgot your XP password.

    "How to connect to your Windows XP-based computer if you forget your password or if your password expires"

    http://support.Microsoft.com/kb/321305

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    Other information above, we can not help you more with this.

    Microsoft prohibits any help given in these Forums for you help bypass or "crack" passwords lost or forgotten.

    Here's information from Microsoft, explaining that the policy:

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/keeping-passwords-secure-Microsoft-policy-on/39f56ef0-5d68-41AD-9daa-6e6019c25d37

    See you soon

  • SYS_REFCURSOR: Variables of the game results or the query return types do not match

    Hello
    I have 2 snippets below, it codes marked 'Test 1' does not work, it gives the error message, see the code below. Why it gives an error? The second code succeeds and works according to the needs.

    Test1 in brief:
    Call proc P3
    Proc calls P3 P1

    Test 2 in brief:
    Call func P2,
    Proc calls P2 P1.

    ---


    1. test 1, it breaks down:
    create or replace procedure P1 ( i_name IN VARCHAR2, 
       o_cur          out   SYS_REFCURSOR )
    is
       v_cur          SYS_REFCURSOR;   
    begin
       open o_cur for
          select i_name from dual;
    end P1;
    /
    
    create or replace function P2 ( i_name IN VARCHAR2
    ) 
    return SYS_REFCURSOR
    is
       v_cur          SYS_REFCURSOR;   
    begin
       p1( i_name, v_cur); 
       return v_cur;
    end P2;
    /
    
    create or replace procedure P3 ( i_name IN VARCHAR2, 
       o_cur          out   SYS_REFCURSOR )
    is
       v_cur          SYS_REFCURSOR;   
    begin
       p1( i_name, o_cur);      
    end P3;
    /
    
    
    declare
       v_name         varchar2(100) := 'test1';
       v_cur          SYS_REFCURSOR;      
       v_fetch_var    varchar2(100);
    begin
       P3(v_name, v_cur);
       --v_cur := P2(v_name);
       
       if v_cur%ISOPEN then
          dbms_output.put_line('v_cur%ISOPEN=true');
       else
          dbms_output.put_line('v_cur%ISOPEN=false');
       end if;
       --
       loop
          fetch v_cur into v_fetch_var;
             exit when v_cur%notfound;
             dbms_output.put_line('v_fetch_var='||v_fetch_var);
       end loop;
    end;
    /*
    Output:
    v_cur%ISOPEN=true
    ORA-06504: PL/SQL: Return types of Result Set variables or query do not match
    ORA-06512: at line 16
    */
    2. test cycle 2, he succeeds:
    create or replace procedure P1 ( i_name IN VARCHAR2, 
       o_cur          out   SYS_REFCURSOR )
    is
       v_cur          SYS_REFCURSOR;   
    begin
       open o_cur for
          select i_name from dual;
    end P1;
    /
    
    create or replace function P2 ( i_name IN VARCHAR2
    ) 
    return SYS_REFCURSOR
    is
       v_cur          SYS_REFCURSOR;   
    begin
       p1( i_name, v_cur); 
       return v_cur;
    end P2;
    /
    
    create or replace procedure P3 ( i_name IN VARCHAR2, 
       o_cur          out   SYS_REFCURSOR )
    is
       v_cur          SYS_REFCURSOR;   
    begin
       p1( i_name, o_cur);      
    end P3;
    /
    
    
    declare
       v_name         varchar2(100) := 'test1';
       v_cur          SYS_REFCURSOR;      
       v_fetch_var    varchar2(100);
    begin
       --P3(v_name, v_cur);
       v_cur := P2(v_name);
       
       if v_cur%ISOPEN then
          dbms_output.put_line('v_cur%ISOPEN=true');
       else
          dbms_output.put_line('v_cur%ISOPEN=false');
       end if;
       --
       loop
          fetch v_cur into v_fetch_var;
             exit when v_cur%notfound;
             dbms_output.put_line('v_fetch_var='||v_fetch_var);
       end loop;
    end;
    /*
    Output:
    PROCEDURE P1 compiled
    FUNCTION P2 compiled
    PROCEDURE P3 compiled
    anonymous block completed
    v_cur%ISOPEN=true
    v_fetch_var=test1
    */
    Published by: CharlesRoos on February 8, 2010 05:06

    CharlesRoos wrote:

    Thenn should be documentation that says "recovery of the data type that sys_refcursor fails if you pass by reference too often."

    I can't really work on what your nested code is supposed to do, but in a simple example, this statement is false.

    SQL> create or replace procedure p1 (l_c out sys_refcursor)
      2  is
      3  begin
      4      open l_c for select dummy from dual;
      5  end;
      6  /
    
    Procedure created.
    
    SQL> create or replace procedure p2 (l_c out sys_refcursor)
      2  is
      3  begin
      4      p1 (l_c);
      5  end;
      6  /
    
    Procedure created.
    
    SQL> var c refcursor
    SQL> exec p2 (:c)
    
    PL/SQL procedure successfully completed.
    
    SQL> print c
    
    D
    -
    X
    
    SQL> create or replace procedure p3 (l_c out sys_refcursor)
      2  is
      3  begin
      4      p2 (l_c);
      5  end;
      6  /
    
    Procedure created.
    
    SQL> exec p3 (:c)
    
    PL/SQL procedure successfully completed.
    
    SQL> print c
    
    D
    -
    X
    
    SQL>
    

    However, I would say from a Ref Cursor once between PL/SQL procedures is already too.

    Re: Extract of the cursor variable

    And there is documentation saying that.

    http://download.Oracle.com/docs/CD/E11882_01/AppDev.112/e10472/static.htm#CIHCJBJJ

    Purpose of cursor Variables

    Variable cursor allows you to pass between PL/SQL stored subprograms and their clientssets of query results. This is possible because the PL/SQL and its clients share a pointer to the work area where the result set is stored.

  • I have tab mix plus update of ff ff29 the add-on was lock up the tabs and I could not access what was the navigation

    I have a problem with the mixture of label more on ff29, I like this add-on from the previous version of and seq., that the problem is there is a glitch in the new ff 29 where the tab on ff is hunged upward with this add on tab mix liked. is there a solution that can solve this problem if not. you have a link to go back to an older version of ff where this addon works. Thank you
    Kevin D

    29,0 Firefox is a beta version of Firefox and not all extensions will be fully compatible with these versions. Beta may also experience other issues. To report a problem, please fill out a bug report on Bugzilla.

    Please note however, that Mozilla does not maintain this add-on. The add-on patches must be made by the developer of the add-on. Please contact the developer to tell them about this problem.

    If you wish to downgrade to the latest version of Firefox, please download it from the homepage of Mozilla.

  • Query based ViewObject does pull not all attributes, when the query has 'WITH' clause

    Hello

    12.1.2 and 12.1.3 JDeveloper

    When we try to create a custom query based ViewObject, and the query clause of "with."

    So not all the columns selected in the query are appearing as attributes of the View object in the wizard.

    This is the query. And it performs very well in Toad.

    WITH dept_count AS)

    SELECT department_id, COUNT (*) AS dept_count

    Employees

    GROUP BY department_id)

    SELECT e.first_name AS employee_name,

    DC1.dept_count AS emp_dept_count,

    m.first_name AS manager_name,

    DC2.dept_count AS mgr_dept_count

    E employees,

    dept_count dc1,

    m employees,

    dept_count dc2

    WHERE e.department_id = dc1.department_id

    AND e.manager_id = m.employee_id

    AND m.department_id = dc2.department_id;

    Only the EmployeeName attribute is extracted from the query. It does not show the rest of the attributes in the VO Wizard.

    VO.png

    (I also tried to create a VO from the EntityObject class and make it editable as false, even in this case all attributes are not displayed.)

    I was wondering if something changed in 12 c?

    It works in 11.1.1.7

    (A friend of mine just asked me this).

    Thanks for any help.

    Sameer

    Jdev dislikes the syntax

    You can rewrite as

    SELECT e.first_name AS employee_name,

    DC1.dept_count AS emp_dept_count,

    m.first_name AS manager_name,

    DC2.dept_count AS mgr_dept_count

    E employees,

    (

    SELECT department_id, COUNT (*) AS dept_count

    Employees

    GROUP BY department_id) dc1,.

    m employees,

    (

    SELECT department_id, COUNT (*) AS dept_count

    Employees

    GROUP BY department_id) dc2

    WHERE e.department_id = dc1.department_id

    AND e.manager_id = m.employee_id

    AND m.department_id = dc2.department_id

    who must work and give you the same result.

    Timo

  • I have just updated my Illustrator and could not find the sidebar on the right that had all the text inside options (size, spacing, etc.) can anyone help!

    I've been using illustrator for some text work, before the update there's a sidebar on the right side that had all the means I could edit the text inside, it's not there anymore since Ive updated. How can I find it?

    Erry,

    We are talking about window > Type > character/paragraph/whatever, you can check (again)?

  • Setup could not access a critical file. Please retry the installation. Error code: 49

    Despite several attempts I still got the message:

    Setup could not access a critical file. Please retry the installation. Error code: 49

    Thanks for your help

    If os win, right click on the Setup file and click "Run as Administrator".

  • 2.1 EA1: Query Builder does not update the query to display the results

    When using the query designer, if you click view results to see the results of the current query, then return to "Select columns" or the tabs 'Create a Where Clause' change the query, the "View results" tab shows again the results of the original query, even if no tables or columns of the original query occurs. By clicking on the button run the report or by setting a refresh interval has no effect.

    On another note, the query designer again is not reentrant, because you cannot select (highlight a part where cursor in) a query, and then open the query for this request of change graphically Designer.

    Sentinel,

    The problem is known and is listed in the known issues in the release notes for the first users. We hope to have this sent to production.

    Returning Query Builder is always on our list of things to do. We intend to rewrite the Query Builder and examine a number of requests related to this function. I'm hoping to make it a priority for the next release.

    Sue

  • To get the result of the query as the column format delimited

    Hi all

    I'm running under query to get database information using an automation tool. The output of the query we receive does not come with the defined value. Is there a way I can change the query to output delimited?

    Please provide your valuable contributions

    SELECT * FROM THE USER. DROP_DOWN_VALUE

    WHERE (SELEC_ID IN (SELECT ID FROM THE USER. PLACE WHERE FIELD_NAME = 'TABLE_NAME'))

    AND DEPENDENT_FIELD = 'XXXXXXX '.


    The query output:


    43202TRANSFORMERTRANSFORMERXXXXXXX


    Expected results:


    43202, TRANSFORMER, TRANSFORMER, XXXXXXX


    Thanks and greetings

    Riyas Hussain

    I'm running under query to get database information using an automation tool. The output of the query we receive does not come with the defined value. Is there a way I can change the query to output delimited?

    Just add / * csv * / in front of the query.

    See examples of different formats in this article by Sql Dev PM Jeff Smith (a frequent contributor of forum):

    http://www.thatjeffsmith.com/archive/2012/05/formatting-query-results-to-CSV-in-Oracle-SQL-Developer/

    SELECT / * csv * / * FROM scott.emp;

    SELECT / * xml * / * FROM scott.emp;

    SELECT / * html * / * FROM scott.emp;

    SELECT / * delimited * / * FROM scott.emp;

    SELECT / * INSERT * / * FROM scott.emp;

    SELECT / * charger * / * FROM scott.emp;

    SELECT / * fixed * / * FROM scott.emp;

    SELECT / * text * / * FROM scott.emp;

Maybe you are looking for