ConnectionProvider

jdbc.connector.ConnectionProvider
See theConnectionProvider companion trait

Attributes

Companion
trait
Source
ConnectionProvider.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

class DriverProvider[F[_]](implicit evidence$1: Console[F], ev: Async[F])

Attributes

Source
ConnectionProvider.scala
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def fromConnection[F[_] : Sync](connection: Connection, logHandler: Option[LogHandler[F]]): ConnectionProvider[F]

Construct a Provider that wraps an existing Connection. Closing the connection is the responsibility of the caller.

Construct a Provider that wraps an existing Connection. Closing the connection is the responsibility of the caller.

Value parameters

connection

a raw JDBC Connection to wrap

logHandler

Handler for outputting logs of process execution using connections.

Attributes

Source
ConnectionProvider.scala
def fromDataSource[F[_] : Async](dataSource: DataSource, connectEC: ExecutionContext, logHandler: Option[LogHandler[F]]): ConnectionProvider[F]

Construct a constructor of Provider[F] for some D <: DataSource When calling this constructor you should explicitly supply the effect type M e.g. ConnectionProvider.fromDataSource[IO](myDataSource, connectEC)

Construct a constructor of Provider[F] for some D <: DataSource When calling this constructor you should explicitly supply the effect type M e.g. ConnectionProvider.fromDataSource[IO](myDataSource, connectEC)

Value parameters

connectEC

Execution context dedicated to database connection.

dataSource

A data source that manages connection information to MySQL.

logHandler

Handler for outputting logs of process execution using connections.

Attributes

Source
ConnectionProvider.scala

Module of constructors for Provider that use the JDBC DriverManager to allocate connections. Note that DriverManager is unbounded and will happily allocate new connections until server resources are exhausted. It is usually preferable to use DataSourceTransactor with an underlying bounded connection pool. Blocking operations on DriverProvider are executed on an unbounded cached daemon thread pool by default, so you are also at risk of exhausting system threads. TL;DR this is fine for console apps but don't use it for a web application.

Module of constructors for Provider that use the JDBC DriverManager to allocate connections. Note that DriverManager is unbounded and will happily allocate new connections until server resources are exhausted. It is usually preferable to use DataSourceTransactor with an underlying bounded connection pool. Blocking operations on DriverProvider are executed on an unbounded cached daemon thread pool by default, so you are also at risk of exhausting system threads. TL;DR this is fine for console apps but don't use it for a web application.

Attributes

Source
ConnectionProvider.scala