Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / March 2007



Tip: Looking for answers? Try searching our database.

cfhttp problem reading file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sammy - 27 Mar 2007 06:58 GMT
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
jdeline - 27 Mar 2007 13:19 GMT
You need </CFHTTP> after your <CFHTTP>.
Sammy - 28 Mar 2007 00:37 GMT
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,ShipmentDate,Backorder,Product,QtyOrdered,QtyShipped,QtyInvoiced,Price,Carrier,Connote,Delivery1,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!!

> You need </CFHTTP> after your <CFHTTP>.
jdeline - 28 Mar 2007 13:13 GMT
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?
Sammy - 28 Mar 2007 23:26 GMT
i'll check it out using MX7 on a II's server

>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?
insuractive - 29 Mar 2007 20:40 GMT
What result are you getting if you perform a <cfump> of your CFHTTP variables?
Sammy - 30 Mar 2007 02:47 GMT
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.

> What result are you getting if you perform a <cfump> of your CFHTTP
> variables?
jdeline - 30 Mar 2007 13:45 GMT
Check out the DFxChange at
http://www.cfxchange.com/?content=tagdetails&area=gallery&subarea=details&tag=20
0&querystring=.  I've used this custom tag before and it seems to handle large
files quite nicely.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.