Inserting records into DB thru Coldfusion Suggestion required

Posted on 2011-10-26
Last Modified: 2012-05-12
I am trying to insert around 2000 record into DB from coldfusion web page but facing with a  time out error.

Can anyone pls help with workaround or suggestion for this issue.
Question by:new_perl_user
    LVL 39

    Accepted Solution

    Set the timeout on your page...

    <cfsetting requestTimeout = "60000">


    Author Comment

    I am new to cold fusion so my question may be silly but..

    Is 60000 secs or mins and what is the maximum time we can allow.
    LVL 39

    Expert Comment


    Glad you asked, I thought it was milliseconds, but it's actually seconds.

    So a setting of 600 should be 10 minutes, 1800 is 30 minutes.

    LVL 51

    Expert Comment

    no points ... gd already answered your original question.

    Just curious. What are you inserting, a CSV file? What's your db type?
    LVL 1

    Expert Comment

    Another tipp:
    If you insert a lot of records into the same database table, you can improve performance a lot by using aggregative sql script:
    Instead of looping over a list or query and inserting one record one after the other with seperate cfquery tags within the loop, it is much quicker to insert a bunch of records within a single transaction. Due to buffering issues at the database you should limit the number of records to e.g. 200 to 500 recs per transaction (=cfquery tag).

    The correct syntax depends on your database, here is a sample for mySQL:
    <cfquery name="dummy" datasource="yourdbname">
    INSERT INTO tablename (fieldname1,fieldname2) VALUES 

    Open in new window


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
    Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them ( . I did keep the main js functions but made sever…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now