MySQL Datasource

    0

    1

    Michael Born

    database

    The first line sets the type of the datasource to MySQL. The next lines specify the hostname, database name, and port to use. The user name and password can be set either as environment variables or passed in as parameters to the datasource. The connectionLimit and connectionTimeout parameters determine the number of active connections and the amount of time that they are allowed to idle, respectively. The blob and clob parameters determine whether the datasource can handle BLOB and CLOB data, respectively. Finally, the storage parameter tells the datasource whether it can be used for session or application storage. The timezone parameter allows you to set the environment timezone. The custom parameter can be used to set custom settings for the datasource.

    Filename pattern: Application.cfc

    this.datasources[ "mysql" ] =  {
        // required
      type: 'mysql'
      , host: 'localhost'
      , database: 'test'
      , port: 3306
      , username: server.system.environment[ "DB_USER" ]
      , password: server.system.environment[ "DB_PASSWORD" ]
    
      // optional
      , connectionLimit: -1 // how many max connections are allowed (-1 == infinite)
      , connectionTimeout:1 // connection timeout in minutes (0 == connection is released after usage) 
      , blob: false // enable blob
      , clob: false // enable clob
      , storage: false // allow to use this datasource as a session/application storage
      , timezone: 'America/New_York'  // if set Lucee change the environment timezone
      , custom: {useUnicode:true,characterEncoding:'UTF-8'} // a struct that contains type specific settings
    };
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.