Browse files

Added documentation for DatabaseUrlDataSource

  • Loading branch information...
jkutner committed Jul 29, 2015
1 parent 615fc0d commit 2ae5320f13a0d7b435704e49e67acaf06f490084
@@ -25,6 +25,12 @@ object Connection extends App {
val db = Database.forDataSource(dataSource: javax.sql.DataSource)
if (false){
val dataSource = null.asInstanceOf[slick.jdbc.DatabaseUrlDataSource]
val db = Database.forDataSource(dataSource: slick.jdbc.DatabaseUrlDataSource)
if(false) {
val jndiName = ""
@@ -38,6 +38,27 @@ until the JVM ends (``DB_CLOSE_DELAY=-1``, which is H2 specific).
.. index:: DataSource
Using a Database URL
A Database URL, a platform independent URL in the
form ``vendor://user:password@host:port/db``,
is often provided by platforms such as Heroku.
You can use a Database URL in Typesafe Config as shown here:
.. includecode:: resources/application.conf#dburl
By default, the data source will use the value of the ``DATABASE_URL`` environment variable.
Thus you may omit the ``url`` property if the ``DATABASE_URL`` environment variable
is set. You may also define a custom environment variable with standard
Typesafe Config syntax, such as ``${?MYSQL_DATABASE_URL}``.
Or you may pass a :javaapi:`DatabaseUrlDataSource <slick/jdbc/DatabaseUrlDataSource>` object to
:api:`forDataSource <slick.jdbc.JdbcBackend$DatabaseFactoryDef@forDataSource(DataSource,AsyncExecutor,Boolean):DatabaseDef>`.
.. includecode:: code/Connection.scala#forDatabaseURL
Using a DataSource
@@ -29,3 +29,13 @@ tsql {
databaseUrl {
dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
properties = {
driver = "slick.driver.PostgresDriver$"
url = "postgres://user:pass@host/dbname"

0 comments on commit 2ae5320

Please sign in to comment.