Troubles in stored procedures (mySQL) in CFMX7

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Troubles in stored procedures (mySQL) in CFMX7

    Hi,

    i'm using for the first time stored procedures in MySQL 5.0.18 and as database
    client i'm using ColdFusion MX7.

    The trouble is that the stored proc doesn't executed, the error message is:

    The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.
    Null Pointers are another name for undefined values.

    My code is:

    <cfstoredproc procedure="storproc" datasource="#dns#" debug="yes">
    <cfprocresult name="RS1">
    </cfstoredproc>

    And the stored proc's code is:


    DELIMITER $$

    DROP PROCEDURE IF EXISTS `techinfinity`.`aree` $$
    CREATE PROCEDURE `techinfinity`.`aree` ()
    BEGIN
    select * from aree;
    END $$

    DELIMITER ;

    Thanks to all and sorry for my english!! :)

    Euripide Guest

  2. Similar Questions and Discussions

    1. #39727 [NEW]: Commands out of sync error when calling MySQL stored procedures from PHP
      From: edoardo at wbr dot it Operating system: Linux PHP version: 4.4.4 PHP Bug Type: MySQL related Bug description: ...
    2. Problem with MySQL 5.0.18, replication and stored procedures
      Hello everybody out there, I've got a problem with MySQL 5, stored procedures and replication. I've searched the MySQL Documentation and the web...
    3. Stored Procedures mySQl 5, CFMX 6.1
      Hi Folks, Today we went about upgrading one of our servers to mySQL 5 in order to use the delights of stored procedures on our new application. ...
    4. cf 7 and mysql 5 stored procedures and temporary tables
      We developed some stored procedures in mysql 5.0.10a that work with coldfusion 7. We upgraded the mysql database to the GA Release of 5.0.15 and...
    5. Need WORKING Example Using Stored Procedures in CFMX7 wOracle9i
      I can't figure out the correct syntax to execute a stored procedure using ColdFusion 7 Standard Edition with an Oracle 9i database. It would be...
  3. #2

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Was it a typo, or are you trying to use a different name in your CFSTOREDPROC than the declared proc name in MySQL?

    <cfstoredproc procedure="techinfinity" datasource="#dns#" debug="yes">

    Phil

    paross1 Guest

  4. #3

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Thanks for your reply Phil.

    Unfortunately also correcting the code,

    <cfstoredproc procedure="techinfinity.aree" datasource="techinfinity"
    debug="yes">
    <cfprocresult name="RS1">
    </cfstoredproc>

    the trouble is the same!!

    The system has attempted to use an undefined value, which usually indicates a
    programming error, either in your code or some system code.
    Null Pointers are another name for undefined values. :(









    Euripide Guest

  5. #4

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Does your stored procedure work? In other words, does it successfully execute
    in MySQL? Try to eliminate the database end before assuming that it is on the
    ColdFusion end. (I've never used MySQL, but I do use lots of SPs in Oracle, and
    have "played" with some in SQL Server.)

    Phil

    paross1 Guest

  6. #5

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    In MySQL the storedproc works!

    In the mySQL GUI (MySQLQueryBrowser) the statement CALL aree();
    returns the correct recordset.
    Is in CF that does't work.
    Euripide Guest

  7. #6

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    and this (without the techinfinity before the aree) doesn't work?

    <cfstoredproc procedure="aree" datasource="techinfinity" debug="yes">
    <cfprocresult name="RS1">
    </cfstoredproc>

    Hmm.... Have you tried a different SP, a simple one that takes no parameters,
    nor returns any result set? Or, one that returns a single parameter out (via
    cfprocparam) instead of an entire result set? In other words, can you call a
    stored procedure at all, or is it just a matter of getting an error because of
    the attempt to return a result set?

    Phil

    paross1 Guest

  8. #7

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Originally posted by: paross1
    and this (without the techinfinity before the aree) doesn't work?

    <cfstoredproc procedure="aree" datasource="techinfinity" debug="yes">
    <cfprocresult name="RS1">
    </cfstoredproc>

    Hmm.... Have you tried a different SP, a simple one that takes no parameters,
    nor returns any result set? Or, one that returns a single parameter out (via
    cfprocparam) instead of an entire result set? In other words, can you call a
    stored procedure at all, or is it just a matter of getting an error because of
    the attempt to return a result set?

    Phil

    Hi Phil,

    simple storedproc, no params nor result set tried on my local host.

    DELIMITER $$

    DROP PROCEDURE IF EXISTS `techinfinity`.`aree` $$
    CREATE PROCEDURE `aree`()
    BEGIN
    DECLARE x INT;
    SET x = 10;
    END $$

    DELIMITER ;

    From CF's template:
    <cfstoredproc procedure="aree" datasource="#APPLICATION.DataSource#"
    debug="yes">
    </cfstoredproc>


    SOME ERROR!!! :( I am crazy!!!


    Euripide Guest

  9. #8

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Wow, very strange. I'm sorry that I do not have any experience using MySQL,
    especially with stored procedures.

    One thing that you might look at is in your data source configuration in
    ColdFusion Administrator. Under Allowed SQL in your advanced parameters, you
    should make sure that Stored Procedures is checked. This is an unlikely
    possibility, and doesn't seem to fit the error that you are seeing, but like I
    said, I'm not at all experienced with setting up MySQL with CF.

    Good luck,
    Phil

    paross1 Guest

  10. #9

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Originally posted by: paross1
    Wow, very strange. I'm sorry that I do not have any experience using MySQL,
    especially with stored procedures.

    One thing that you might look at is in your data source configuration in
    ColdFusion Administrator. Under Allowed SQL in your advanced parameters, you
    should make sure that Stored Procedures is checked. This is an unlikely
    possibility, and doesn't seem to fit the error that you are seeing, but like I
    said, I'm not at all experienced with setting up MySQL with CF.

    You didn't say if you could get good results with CFQUERY, but I assume that
    you have successfully connected to the database and returned results.
    Otherwise, I would suspect a possible driver problem.

    Good luck,
    Phil

    Very very strange!!!
    In CFAdmin under Allowed SQL the stored procedures option is checked!

    With <cfquery> tag my application does connect succesfully to db server.
    I don't know... i've made a lot of searches on the web but nothing...



    Euripide Guest

  11. #10

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Just a SWAG, but could it perhaps be the JDBC driver that you are using?
    According to this [url]http://www.macromedia.com/go/tn_19170[/url] ,

    All versions of Macromedia ColdFusion MX include a MySQL JDBC Type 4 driver.
    However, some users may choose to use more recent MySQL JDBC drivers
    distributed by MySQL in order to use newer features of MySQL.

    I wonder if "newer features" means stored procedures?

    Phil


    paross1 Guest

  12. #11

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Originally posted by: paross1
    Just a SWAG, but could it perhaps be the JDBC driver that you are using?
    According to this [url]http://www.macromedia.com/go/tn_19170[/url] ,

    All versions of Macromedia ColdFusion MX include a MySQL JDBC Type 4 driver.
    However, some users may choose to use more recent MySQL JDBC drivers
    distributed by MySQL in order to use newer features of MySQL.

    I wonder if "newer features" means stored procedures?

    Phil


    Hi Phil,

    and thanks for your help. ;)

    I'm reading the tech note and i'll try to update my MySQL JDBC drivers at the
    most recent version....




    Euripide Guest

  13. #12

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    I've updated my JDBC drivers at 3.1.12 version and stored procs executed
    succesfully.. with a little problem ;)

    First, the success.

    SP 'aree' in MySQL:
    DELIMITER $$

    DROP PROCEDURE IF EXISTS `techinfinity`.`aree` $$
    CREATE PROCEDURE `aree`(out param1 int)
    BEGIN
    select count(*) into param1 from aree;
    END $$

    DELIMITER ;

    In my CF's template:

    <cfstoredproc procedure="aree" datasource="#APPLICATION.DataSource#">
    <cfprocparam type="Out" cfsqltype="CF_SQL_INTEGER" variable="param1">
    </cfstoredproc>
    <cfoutput>#param1#</cfoutput>

    Result OK.

    StoredProc prodotti in MySQL.

    DELIMITER $$

    DROP PROCEDURE IF EXISTS `techinfinity`.`prodotti` $$
    CREATE PROCEDURE `prodotti`()
    BEGIN
    select * from prodotti;
    END $$

    DELIMITER ;

    In CF:
    <cfquery name="q" datasource="#APPLICATION.DataSource#">
    {CALL prodotti()}
    </cfquery>

    <cfdump var="#q#">

    Dumping executed successfully.



    Now, the problem:
    When i call the sp with

    <cfstoredproc procedure="prodotti" datasource="#APPLICATION.DataSource#">
    <cfprocresult name="prodotti">
    </cfstoredproc>

    CF show this error:
    You have an error in your SQL syntax; check the manual that corresponds to
    your MySQL server version for the right syntax to use near '' at line 1
    SQL {call prodotti}
    DATASOURCE techinfinity
    VENDORERRORCODE 1064
    SQLSTATE 42000


    I don't undestand!!

    Thanks Phil!


    Euripide Guest

  14. #13

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Just another SWAG, but try selecting discrete column names from your table
    instead of SELECT *. Since VENDORERRORCODE 1064 equates to a MySQL
    ER_PARSE_ERROR error, perhaps there is something in the column names that you
    are selecting that it doesn't "like". Interesting that the CFQUERY method
    worked but CFPROCRESULT couldn't handle the return result set. Oh, and also,
    the ResultSet parameter in the CFPROCRESULT is optional and defaults to 1, but
    you might try specifying ResultSet="1", just in case it "thinks" that you are
    attempting to return more than one result set.

    Like I said, a SWAG and shot in the dark, but I have really haven't a clue why
    this is working this way, unless you may be dealing with a MySQL bug too. I
    know that it took me quite a while to figure out most of the "weird-nesses" of
    calling Oracle stored procedures with CF, especially since every new version of
    ColdFusion handled the return of result sets differently. That was lots of fun
    having to modify hundreds of SP calls every time I upgraded to a new version of
    CF.

    Anyway, good luck,
    Phil

    paross1 Guest

  15. #14

    Default Re: Troubles in stored procedures (mySQL) in CFMX7

    Originally posted by: paross1
    Just another SWAG, but try selecting discrete column names from your table
    instead of SELECT *. Since VENDORERRORCODE 1064 equates to a MySQL
    ER_PARSE_ERROR error, perhaps there is something in the column names that you
    are selecting that it doesn't "like". Interesting that the CFQUERY method
    worked but CFPROCRESULT couldn't handle the return result set. Oh, and also,
    the ResultSet parameter in the CFPROCRESULT is optional and defaults to 1, but
    you might try specifying ResultSet="1", just in case it "thinks" that you are
    attempting to return more than one result set.

    Like I said, a SWAG and shot in the dark, but I have really haven't a clue why
    this is working this way, unless you may be dealing with a MySQL bug too. I
    know that it took me quite a while to figure out most of the "weird-nesses" of
    calling Oracle stored procedures with CF, especially since every new version of
    ColdFusion handled the return of result sets differently. That was lots of fun
    having to modify hundreds of SP calls every time I upgraded to a new version of
    CF.

    Anyway, good luck,
    Phil


    Hi Phil,

    new SP, i used discrete column names:
    DELIMITER $$

    DROP PROCEDURE IF EXISTS `techinfinity`.`prodotti` $$
    CREATE PROCEDURE `prodotti`()
    BEGIN
    select nomeprodotto from prodotti;
    END $$

    DELIMITER ;

    but CF give me an exception: Sintax error in mysql.
    The cfquery version instead works succesfully...

    <cfquery name="result" datasource="#APPLICATION.DataSource#">
    CALL prodotti()
    </cfquery>
    <cfdump var="#result#">

    At this point, i'll use a cfquery version... that i can also cache it!

    Euripide Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139