Datasourcecreate()
Adds a new datasource to the system for use with any database functions. This does not persist over server restarts
Usage
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]) ] |
Calling
Supports named-parameter calling allowing you to use the function like:
Datasourcecreate( datasource=?, details=? );
Supports passing parameters as a structure using ArgumentCollection:
Datasourcecreate( ArgumentCollection={ datasource : ?, details : ? } );
Extra
The following shows an example of creating a datasource using CFML.
<cfscript> if ( !DataSourceIsValid("myds") ){ var ds = { username : "user1", password : "password1", databasename : "MyDatabase", drivername : "org.gjt.mm.mysql.Driver", hoststring : "jdbc:mysql://8.8.8.8/MyDatabase?useUnicode=true&characterEncoding=UTF-8" }; DataSourceCreate( "myds", ds ); } </cfscript>
See Also
Csvread
Csvwrite
Datasourcecreate
Datasourcedelete
Datasourceinfo
Datasourceisvalid
Dbinfo
QueryAddcolumn
QueryAddrow
QueryColumnarray
QueryColumnlist
QueryDeletecolumn
QueryDeleterow
QueryEach
QueryIsempty
QueryNew
QueryOfqueryrun
QueryRenamecolumn
QueryRequestmetrics
QueryRowstruct
QueryRun
QuerySetcell
QuerySort
QueryToarray
Quotedvaluelist
ToHtml
Valuelist