Adds a new datasource to the system for use with any database functions. This does not persist over server restarts


BOOLEAN = Datasourcecreate( datasource, details )
Argument Summary
datasource datasource name to create
details struct containing datasource information Keys=[hoststring, drivername, databasename, username, password, (optional)(logintimeout [seconds that will wait until a connection from the pool becomes available default=30], connectiontimeout [seconds it will attempting to make a connection default=30], maxconnections [total max connections allowed at any point in time default=3], maxlivetime [seconds that a connection can remain active for before it is removed from the pool default=360], maxusage [number of times this connection will be reused before manually being closed default=1000], connectionretries [number of times it will attempt to reconnect default=0], initstring, connectionperpage [disables system pool and uses page-pool instead. new connection per page]) ]


Supports named-parameter calling allowing you to use the function like:


Supports passing parameters as a structure using ArgumentCollection:

Datasourcecreate( ArgumentCollection={
   datasource : ?, 
   details : ?
} );


The following shows an example of creating a datasource using CFML.

if ( !DataSourceIsValid("myds") ){
  var ds = {
    username : "user1",
    password : "password1",
    databasename : "MyDatabase",
    drivername : "",
    hoststring : "jdbc:mysql://"

  DataSourceCreate( "myds", ds );