conn 配置
来源:互联网 发布:java poijar包 编辑:程序博客网 时间:2024/06/08 16:59
一.
1.Using Typesafe Config
mydb = { dataSourceClass = "org.postgresql.ds.PGSimpleDataSource" properties = { databaseName = "mydb" user = "myuser" password = "secret" } numThreads = 10}
2.Using a JDBC URL
val db = Database.forURL("jdbc:h2:mem:test1;DB_CLOSE_DELAY=-1", driver="org.h2.Driver")
3.Using a DataSource
val db = Database.forDataSource(dataSource: javax.sql.DataSource)
4.Using a JNDI Name
val db = Database.forName(jndiName: String)
二.Database thread pool
val db = Database.forURL("jdbc:h2:mem:test1;DB_CLOSE_DELAY=-1", driver="org.h2.Driver", executor = AsyncExecutor("test1", numThreads=10, queueSize=1000))
Tag:
Every Database contains an AsyncExecutor that manages the thread pool for asynchronous execution of Database I/O Actions. Its size is the main parameter to tune for the best performance of the Databaseobject. It should be set to the value that you would use for the size of the connection pool in a traditional, blocking application (see About Pool Sizing in the HikariCP documentation for further information). When using Database.forConfig, the thread pool is configured directly in the external configuration file together with the connection parameters. If you use any other factory method to get a Database, you can either use a default configuration or specify a custom AsyncExecutor:
DatabaseConfig
tsql { driver = "slick.driver.H2Driver$" db { connectionPool = disabled driver = "org.h2.Driver" url = "jdbc:h2:mem:tsql1;INIT=runscript from 'src/main/resources/create-schema.sql'" }}
Tag:
On top of the configuration syntax for Database, there is another layer in the form of DatabaseConfigwhich allows you to configure a Slick driver plus a matching Database together. This makes it easy to abstract over different kinds of database systems by simply changing a configuration file.
- conn 配置
- Conn
- conn
- conn
- conn
- conn
- conn
- conn文件
- conn.asp
- Conn文件
- Conn.java
- conn 注册
- CONN Notes
- SH配置中,hibernate不会自动释放session conn程序卡死
- 捕获CONN错误
- Conn.RollBackTrans使用
- conn防注入
- conn.php源代码分析
- C primer plus(第五版)编程练习第十五章
- 每天一个linux命令(50):crontab命令
- uva 122
- LeetCode—Remove Linked List Elements—C++
- php的事件处理机制(回调函数)
- conn 配置
- JSON再研究
- Oracle INSERT 语句
- 最大连续子序列
- virsh console
- Longest Substring Without Repeating Character
- LSM树由来、设计思想以及应用到HBase的索引
- 2015061703 - mysql数据类型整理
- 第009讲 初识css 类选择器 id选择器 html选择器