bonecp

Slick and bonecp: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already error

若如初见. 提交于 2019-12-05 13:47:57
Locally when I am developing my application I launch my play2 application using sbt run I love how I can make code changes, and then reload my browser to see my changes. After about roughly 10 code changes or so, I get a postgresql too many connection error (see below). My db connection is using the below DatabaseAccess.scala class. I'm guessing on each reload it is creating a bunch of connections to postgresql. In my Global am currently doing: override def onStart(app: Application) { Logger.info("Global.onStart") DatabaseAccess.loadConfiguration() } In production I am also worried that if I

Java Connection Pooling best practices?

安稳与你 提交于 2019-12-03 07:14:42
问题 After getting fed up with c3p0's constant locking I'm turning to BoneCP for an alternative connection pool for my database. I have a server app that processes around 7,000 items per minute and needs to log those items into our MySQL database. I currently have 100 worker threads and have set up my pool like such: BoneCPConfig config = new BoneCPConfig(); config.setJdbcUrl("jdbc:mysql://"+Settings.MYSQL_HOSTNAME+"/"+Settings.MYSQL_DATABASE+"?autoReconnectForPools=true" ); config.setUsername

Java Connection Pooling best practices?

给你一囗甜甜゛ 提交于 2019-12-02 22:00:56
After getting fed up with c3p0's constant locking I'm turning to BoneCP for an alternative connection pool for my database. I have a server app that processes around 7,000 items per minute and needs to log those items into our MySQL database. I currently have 100 worker threads and have set up my pool like such: BoneCPConfig config = new BoneCPConfig(); config.setJdbcUrl("jdbc:mysql://"+Settings.MYSQL_HOSTNAME+"/"+Settings.MYSQL_DATABASE+"?autoReconnectForPools=true" ); config.setUsername(Settings.MYSQL_USERNAME); config.setPassword(Settings.MYSQL_PASSWORD); config

springboot2 配置druid数据链接池,监控控制台

妖精的绣舞 提交于 2019-12-02 05:45:43
Druid是什么? Druid首先是Java语言中最好的数据库连接池,也是阿里巴巴的开源项目。Druid是阿里巴巴开发的号称为监控而生的数据库连接池,在功能、性能、扩展性方面,都超过其他数据库连接池,包括DBCP、C3P0、BoneCP、Proxool、JBoss DataSource等等等,秒杀一切。而且Druid已经在阿里巴巴部署了超过600个应用,经过好几年年生产环境大规模部署的严苛考验! filters: stat,wall,log4j stat:Druid内置提供一个StatFilter,用于统计监控信息。如果需要配置访问页面可以参考,https://github.com/alibaba/druid/wiki/%E9%85%8D%E7%BD%AE_StatViewServlet%E9%85%8D%E7%BD%AE,我还没有研究这个,有研究的麻烦留意告诉一下,以后会找机会更新上来,毕竟很好用。 wall:Druid防御SQL注入攻击的WallFilter就是通过Druid的SQL Parser分析。Druid提供的SQL Parser可以在JDBC层拦截SQL做相应处理,比如说分库分表、审计等。 log4j:这个就是日志记录的功能,可以把sql语句打印到log4j供排查问题。 第一步:配置pom.xml <dependency> <groupId>mysql<

Cannot change transaction read-only property in the middle of a transaction

為{幸葍}努か 提交于 2019-12-01 23:42:46
问题 I am using BoneCP with Postgresql and Spring JdbcTemplate. When JdbcTemplate executes query and then tries to close the connection, it gets this exception: org.postgresql.util.PSQLException: Cannot change transaction read-only property in the middle of a transaction. at org.postgresql.jdbc2.AbstractJdbc2Connection.setReadOnly(AbstractJdbc2Connection.java:725) at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1279) at com.jolbox.bonecp.ConnectionHandle.(ConnectionHandle

Cannot change transaction read-only property in the middle of a transaction

吃可爱长大的小学妹 提交于 2019-12-01 21:17:06
I am using BoneCP with Postgresql and Spring JdbcTemplate. When JdbcTemplate executes query and then tries to close the connection, it gets this exception: org.postgresql.util.PSQLException: Cannot change transaction read-only property in the middle of a transaction. at org.postgresql.jdbc2.AbstractJdbc2Connection.setReadOnly(AbstractJdbc2Connection.java:725) at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1279) at com.jolbox.bonecp.ConnectionHandle.(ConnectionHandle.java:254) at com.jolbox.bonecp.ConnectionHandle.recreateConnectionHandle(ConnectionHandle.java:273) at

Defining an alternate connection pool in Grails 2.3.6

岁酱吖の 提交于 2019-11-30 20:19:00
I know that, at some point between Grails 1.X and Grails 2.X, the default connection pooling library changed from commons-dbcp to tomcat-dbcp . Now, I'm trying to configure either BoneCP or HikariCP as the connection pooling library for my Grails application. However, I see that this answer offers a solution which might only apply to Grails 1.X. I also found this Gist , but again, I don't know which Grails version it applies to. So, is it possible to define a custom connection pool inside a Grails 2.3.6 application? Thanks! UPDATE: OK so you actually need to tell Grails not to pool the

BoneCP correct usage

淺唱寂寞╮ 提交于 2019-11-30 14:55:57
问题 I've just started using BoneCP and pulled the sample JDBC code from the authors site. I have a function called getConnection() that returns a connection here is a snippet: // setup the connection pool BoneCPConfig config = new BoneCPConfig(); // Config goes here. connectionPool = new BoneCP(config); // setup the connection pool return connectionPool.getConnection(); // fetch a connection Now, my questions: 1) Do I call connection.close() when I am finished using the connection that is

Is “Tomcat 7 JDBC Connection Pool” good enough for production? And how is it compare to BoneCP?

不打扰是莪最后的温柔 提交于 2019-11-30 12:28:02
问题 Our site get roughly 1M pv/day, and we use Tomcat for sure. I couldn't find much information about jdbc-pool, not sure if it's stable enough for production. Anyone got experience on it? and any configuration/tuning stuff for reference? As someone mentioned, BoneCP might be another choice. But seems it's discontinued (so sad...). Would it be a better choice? btw, HikariCP is too young, I would keep an eye on it as it's the latest/fastest CP so far I found. Thanks for any advice. 回答1: I'm one

Using BoneCP: Handling connections from the pool

╄→гoц情女王★ 提交于 2019-11-30 09:51:11
I have just started using BoneCP and this is my first time using a connection pool. I'm somewhat confused as to how I am supposed to use it. Currently I am saving the BoneCP-object as a static variable, and thus I can use it between different connections. When I'm done with the connection, I close it with connection.close() . Should I do this, or should I not close it to enable it to be reused by the pool? This is my current implementation to get a connection: private static BoneCP connectionPool; public Connection getConnection() throws SQLException { if (connectionPool == null) { initPool();