A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://github.com/trinidad/trinidad_dbpool_extension below:

trinidad/trinidad_dbpool_extension: Database connection pool for Trinidad

A bunch of Trinidad extensions to support database connection pooling on top of the underlying Apache Tomcat container (using Tomcat's JDBC Connection Pool).

Please note, that such pools are usually configured as "global" and thus shareable by multiple applications deployed on to of the Trinidad server.

Also most Java issues caused by JDBC drivers packaged with the application (e.g. java.lang.UnsatisfiedLinkError with SQLite3's JDBC driver) that JRuby inherits should go away when database connections are managed externally.

http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

  web_apps:
    default:
      extensions:
        mysql_dbpool:                   # EXTENSION NAME AS KEY
          jndi: 'jdbc/MySampleDB'       # name (linked with database.yml)
          url: 'localhost:3306/sample'  # database URL (or full jdbc: URL)
          username: root
          password: root
          maxActive:  100  # maximum number of connections managed by the pool
          initialSize: 10  # initial number of connections created in the pool
          maxWait:  10000  # ms the pool waits for a connection to be returned

jndi, url are mandatory (as well username and password if your database server + driver requires authentication), while other supported configuration options might be found here in Tomcat's JDBC pool documentation :

http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#Common_Attributes

NOTE: starting version 0.7 we switched to using Tomcat's JDBC pool which is simpler and more performant pool designed specifically for Tomcat/Trinidad.

If you insist on using DBCP set the (deprecated) pool: dbcp option along side your pool configuration ...

If you happen to be using SQLite on production you'll need an absolute path :

  extensions:
    sqlite_dbpool:
      jndi: jdbc/FileDB
      url: <%= File.expand_path('db/production.db') %>
production:
  adapter: mysql
  jndi: java:/comp/env/jdbc/MySampleDB
  # (Java) JDBC driver class name is detected for built-in adapters that
  # activerecord-jdbc-adapter supports, specify for a "generic" adapter
  # driver: com.mysql.jdbc.Driver

do not forget to delete pool setup part since there's no need for it ...

If there's no "official" pool for your database, or would like to use a different version of a JDBC driver for a supported Trinidad pool, this allows you to completely customize a pool.

NOTE: You will need a JDBC driver for your database, check the driver DB if unsure about how to get one http://developers.sun.com/product/jdbc/drivers

Sample configuration for a DB2 database :

---
  extensions:
    generic_dbpool:                          # EXTENSION NAME AS KEY
      jndi: 'jdbc/MyDB'                      # JNDI name
      url: 'jdbc:db2://127.0.0.1:50000/MYDB' # specify full jdbc: URL
      username: 'mydb'                       # database username
      password: 'pass'                       # database password
      driverPath: '/opt/IBM/DB2/db2jcc4.jar' # leave out if on class-path
      driverName: com.ibm.db2.jcc.DB2Driver  # resolved from driverPath jar

Beyond standard configuration options there's 2 specific options here :

Copyright (c) 2014 Team Trinidad. See LICENSE (http://en.wikipedia.org/wiki/MIT_License) for details.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4