使用jdbc在google cloud sql中连接池

时间:2022-01-06 13:22:24

I am trying to develop an application using google cloud sql and cloud endpoints , from the google cloud sql documentation i observed that the connector for google cloud sql does not provide any connection pooling mechanism , i tried searching online to get any possible tutorial or documentation that provides a pooling mechanism but no result , The google documentation just states that you should close connections in the finally block without any connection pooling configuration , I also came across pooling libraries like BoneCp, TomcatDbCp , i'm considering using those options but im not sure about their compatibility with google cloud sql . My front end is a web application and pooling is a must for my application , Please any thoughts or suggestions are welcomed .

我正在尝试使用谷歌云sql和云端点开发应用程序,从谷歌云sql文档我观察到谷歌云sql的连接器不提供任何连接池机制,我尝试在线搜索获得任何可能的教程或文档,提供了一个池化机制,但没有结果,谷歌文档只是声明你应该关闭finally块中的连接,没有任何连接池配置,我也遇到了像BoneCp,TomcatDbCp这样的池库,我正在考虑使用这些选项,但我不确定关于他们与谷歌云sql的兼容性。我的前端是一个Web应用程序,池是我的应用程序必须的,请欢迎任何想法或建议。

1 个解决方案

#1


1  

Cloud SQL itself does not provide connection pooling, however any connection pooling system that supports JDBC will successfully use Cloud SQL. One limitiation, mentioned on this SO answer, is that no native threads are allowed. This user recommends Tomcat DBCP, so that seems like a good place to start.

Cloud SQL本身不提供连接池,但是任何支持JDBC的连接池系统都将成功使用Cloud SQL。在这个SO答案中提到的一个限制是不允许本机线程。此用户推荐Tomcat DBCP,因此这似乎是一个好的起点。

#1


1  

Cloud SQL itself does not provide connection pooling, however any connection pooling system that supports JDBC will successfully use Cloud SQL. One limitiation, mentioned on this SO answer, is that no native threads are allowed. This user recommends Tomcat DBCP, so that seems like a good place to start.

Cloud SQL本身不提供连接池,但是任何支持JDBC的连接池系统都将成功使用Cloud SQL。在这个SO答案中提到的一个限制是不允许本机线程。此用户推荐Tomcat DBCP,因此这似乎是一个好的起点。