我可以在 ColdFusion 中进行无缓冲查询吗?

发布于 2024-11-27 04:03:14 字数 290 浏览 1 评论 0原文

我正在将 Java 桌面应用程序移植到 ColdFusion Web 应用程序。该桌面应用程序使用非常大的结果集(数千条文本记录)进行查询,虽然在数据库端没有问题,但如果对其进行缓冲,可能会在客户端占用大量内存。因此,应用程序明确告诉数据库驱动程序不要缓冲太多结果。

现在我正在处理 ColdFusion 端口,我遇到了缓冲问题。 ColdFusion 页面在 调用期间超时,我相当确定这是因为它尝试缓冲所有内容。

我可以在 ColdFusion 中进行无缓冲查询吗?

I'm in the process of porting a Java desktop application to a ColdFusion web app. This desktop app made queries with very large result sets (thousands of text records) that, while being all right on the database side, could take a lot of memory on the client side if they were buffered. For this reason, the app explicitly tells the database driver to not buffer results too much.

Now that I'm working on the ColdFusion port, I'm being hit by the buffering problem. The ColdFusion page times out during the <cfquery> call, and I'm fairly sure this is because it tries to buffer everything.

Can I make an unbuffered query in ColdFusion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

つ可否回来 2024-12-04 04:03:14

如果分页不是一个选项(例如,您正在写一份报告),那么您必须使用 setFetchSize() 获得较低的 java 级别。请参阅此答案。请注意,答案中的代码使用 DataSourceService,该服务带有 Adob​​e 的最新安全补丁,在 CF8 上不再可用。您必须弄清楚如何通过 adminapi 获取连接或在 Coldfusion 之外创建连接。或者您可以将数据源转换为使用 JNDI,然后您可以自己查找资源,而无需使用 CF api。

If pagination is not an option (i.e., you're writing out a report for example), then you'll have to get low level with the java, using setFetchSize(). See this answer. Note that the code in the answer uses the DataSourceService, which, with latest security patches from Adobe, is no longer available on CF8. You'll have to figure out how to get a connection via the adminapi or create a connection outside of coldfusion. Or you could transition your datasource to use JNDI, and then you can lookup the resource yourself without using CF api's.

挖鼻大婶 2024-12-04 04:03:14

我几乎可以肯定 ColdFusion 不提供这样的机制。作为一种语言,它的目的是将开发人员从类似的事情中抽象出来。

我建议您研究几个选项:

  • 重新处理您的查询以使用分页,并循环运行它。
  • 使用 上的 timeout 属性来防止发生超时
  • 使用 CreateObject() 语法实例化 JDBC 数据库连接。

使用最后一个选项,您实际上要做的是访问底层 Java 类来执行查询和获取结果。看看这篇文章< /a> 快速查看 CreateObject() 函数。

您还可以查看该函数的 Adobe Livedocs ,但它们似乎并没有真正的帮助。

我还没有尝试使用 CreateObject() 来对 Java 数据库访问类进行查询,但我想您可能可以让它工作。

I'm almost certain that ColdFusion does not provide such a mechanism. As a language, it was meant to abstract the developer away from things like that.

I'd suggest that you look into a few options:

  • Re-work your query to use pagination, and run it in a loop.
  • Use the timeout attribute on the <cfquery> to prevent timeouts from happening
  • Use the CreateObject() syntax to instantiate a JDBC database connection.

With the last option, what you'd actually do is access the underlying Java classes to do the querying and getting results. Take a look at this article for a quick look at the CreateObject() function.

You can also look at the Adobe Livedocs for the function, but they don't really seem helpful.

I haven't tried to use CreateObject() to do querying with the Java database access classes, but I imagine that you can probably get it to work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文