Can I make an unbuffered request in ColdFusion?

I am porting a Java desktop application to a ColdFusion web application. This desktop application created queries with very large sets of results (thousands of text entries) that, being fine on the database side, could take up a lot of memory on the client side if they were buffered. For this reason, the application explicitly tells the database driver not too many buffering results.

Now that I'm working on the ColdFusion port, I am hit by a buffering problem. The ColdFusion page is torn during a <cfquery> call, and I'm sure this is because it is trying to buffer everything.

Is it possible to create an unbuffered query in ColdFusion?

+4
source share
2 answers

I'm pretty sure ColdFusion does not provide such a mechanism. As a language, he was supposed to distract the developer from such things.

I suggest you explore a few options:

  • Repeat your query to use pagination and run it in a loop.
  • Use the timeout attribute in <cfquery> to prevent timeout.
  • Use the CreateObject() syntax to create a connection to the JDBC database.

With the latter option, what you are actually doing is accessing the Java base classes to execute queries and get results. Check out this article to quickly see the CreateObject() function.

You can also look at Adobe Livedocs for a feature , but they really don't seem useful.

I have not tried using CreateObject() to execute queries with Java database access classes, but I assume that you can probably get it working.

+1
source

If pagination is not an option (i.e. you are writing a report, for example), you will need to get low using java using setFetchSize (). See this answer . Note that the code response uses a DataSourceService, which with the latest security fixes from Adobe is no longer available on CF8. You will need to figure out how to get the connection through adminapi or create a connection outside of coldfusion. Or you can translate your data source to use JNDI , and then you can search for the resource yourself without using CF api's.

+2
source

All Articles