7 Replies Latest reply on Mar 30, 2007 5:45 AM by jdeline

    cfhttp problem reading file

    Level 7
      Hi there,

      The code below works fine on my local host computer and databse setup.
      cfhttp will read my file fine and output the number of rows.


      When i attempt to run this code on my web host's CF and MS II's server i get
      a - HTTP 500 - Internal server error in Internet Explorer and a blank page
      in firefox.


      Does anybody know why this would be happenning. I've heard cfhttp has some
      bugs but i couldnt find a solution after looking at various blogs on the
      matter. Not sure if its timing out or what?



      <cfsetting requesttimeout="900">

      <cfhttp method="get" textqualifier=" " firstrowasheaders="no" delimiter="|"
      name="test" columns="OrderNo, Line, seq, AccountNo, Shipment, Invoice,
      PurchaseOrder, Completed, OrderDate, ShipmentDate, Backorder, Product,
      QtyOrdered, QtyShipped, QtyInvoiced, Price, Carrier, Connote, Delivery1,
      Delivery2, Delivery3, Delivery4, Delivery5, Delivery6, Delivery7, expected"
      url=" http://xxxxxx.com/xxx/zzzzz.txt">

      Read in <cfoutput>#test.RecordCount#</cfoutput> records


        • 1. Re: cfhttp problem reading file
          jdeline Level 1
          You need </CFHTTP> after your <CFHTTP>.
          • 2. Re: cfhttp problem reading file
            Level 7
            Heres my complete code what im trying to achieve. In IE i get a http 500
            internal error and in firefox i get a blank page. im strating to think it
            may be a database permission problem although i have made sure my user has
            full permissions on the order_history table.

            any ideas whta im doing wrong?




            <cfquery name="delete" datasource="#client.dsn#"
            username="#client.username#" passWord="#client.password#">
            delete from order_history
            </cfquery>

            <cfhttp timeout="900" method="get" textqualifier=" " firstrowasheaders="no"
            columns="OrderNo,Line,seq,AccountNo,Shipment,Invoice,PurchaseOrder,Completed,OrderDate,Sh ipmentDate,Backorder,Product,QtyOrdered,QtyShipped,QtyInvoiced,Price,Carrier,Connote,Deliv ery1,Delivery2,Delivery3,Delivery4,Delivery5,Delivery6,Delivery7,expected"
            delimiter="|" name="test" url=" http://xxxxxxxx.com/prms/ordhist1.txt">
            </cfhttp>

            <cfloop query="test">

            <cfquery name="insert" datasource="#client.dsn#"
            username="#client.username#" passWord="#client.password#">
            INSERT INTO order_history
            (OrderNo, Line, seq, AccountNo, Shipment, Invoice, PurchaseOrder, Completed,
            OrderDate, ShipmentDate, Backorder, Product, QtyOrdered, QtyShipped,
            QtyInvoiced, Price, Carrier, Connote, Delivery1, Delivery2, Delivery3,
            Delivery4, Delivery5, Delivery6, Delivery7, expected)
            VALUES (
            <cfqueryparam value='#test.OrderNo#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.Line#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.seq#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.AccountNo#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.shipment#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.invoice#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.purchaseorder#' cfsqltype="cf_sql_varchar"
            maxlength="20">,
            <cfqueryparam value='#test.completed#' cfsqltype="cf_sql_varchar"
            maxlength="12">,
            <cfqueryparam value='#test.orderdate#' cfsqltype="cf_sql_varchar"
            maxlength="12">,
            <cfqueryparam value='#test.shipmentdate#' cfsqltype="cf_sql_varchar"
            maxlength="12">,
            <cfqueryparam value='#test.backorder#' cfsqltype="cf_sql_varchar"
            maxlength="10">,
            <cfqueryparam value='#test.product#' cfsqltype="cf_sql_varchar"
            maxlength="20">,
            <cfqueryparam value='#test.qtyordered#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.qtyshipped#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.qtyinvoiced#' cfsqltype="cf_sql_integer">,
            <cfqueryparam value='#test.price#' cfsqltype="cf_sql_varchar"
            maxlength="15">,
            <cfqueryparam value='#test.carrier#' cfsqltype="cf_sql_varchar"
            maxlength="20">,
            <cfqueryparam value='#test.connote#' cfsqltype="cf_sql_varchar"
            maxlength="20">,
            <cfqueryparam value='#test.delivery1#' cfsqltype="cf_sql_varchar"
            maxlength="150">,
            <cfqueryparam value='#test.delivery2#' cfsqltype="cf_sql_varchar"
            maxlength="100">,
            <cfqueryparam value='#test.delivery3#' cfsqltype="cf_sql_varchar"
            maxlength="100">,
            <cfqueryparam value='#test.delivery4#' cfsqltype="cf_sql_varchar"
            maxlength="100">,
            <cfqueryparam value='#test.delivery5#' cfsqltype="cf_sql_varchar"
            maxlength="100">,
            <cfqueryparam value='#test.delivery6#' cfsqltype="cf_sql_varchar"
            maxlength="100">,
            <cfqueryparam value='#test.delivery7#' cfsqltype="cf_sql_varchar"
            maxlength="100">,
            <cfqueryparam value='#test.expected#' cfsqltype="cf_sql_varchar"
            maxlength="12">)

            </cfquery>

            </cfloop>

            FINISHED!!



            "jdeline" <jdeline@deline.com> wrote in message
            news:eub244$lc$1@forums.macromedia.com...
            > You need </CFHTTP> after your <CFHTTP>.


            • 3. Re: cfhttp problem reading file
              jdeline Level 1
              I presume you have double-checked the data types of all columns and that the CFSQLTYPEs are correct. I seem to remember that there was a problem with CFSQLTYPE in an earlier version of ColdFusion. What version and platform are you using?
              • 4. Re: cfhttp problem reading file
                Level 7
                i'll check it out using MX7 on a II's server


                "jdeline" <jdeline@deline.com> wrote in message
                news:eudm61$e7m$1@forums.macromedia.com...
                >I presume you have double-checked the data types of all columns and that
                >the
                > CFSQLTYPEs are correct. I seem to remember that there was a problem with
                > CFSQLTYPE in an earlier version of ColdFusion. What version and platform
                > are
                > you using?
                >


                • 5. Re: cfhttp problem reading file
                  insuractive Level 3
                  What result are you getting if you perform a <cfump> of your CFHTTP variables?
                  • 6. Re: cfhttp problem reading file
                    Level 7
                    Thanks for help guys it seems to be a file size problem.

                    the text file I was reading was 25mb and cfhttp seems to die, as it loads it
                    into a query set.

                    Under 20mb and my code seems to work ok.


                    "insuractive" <webforumsuser@macromedia.com> wrote in message
                    news:euh4ml$1mq$1@forums.macromedia.com...
                    > What result are you getting if you perform a <cfump> of your CFHTTP
                    > variables?


                    • 7. Re: cfhttp problem reading file
                      jdeline Level 1
                      Check out the DFxChange at http://www.cfxchange.com/?content=tagdetails&area=gallery&subarea=details&tag=200&querystr ing=. I've used this custom tag before and it seems to handle large files quite nicely.