| 1 |
;;; odbc setup file |
| 2 |
|
| 3 |
; ENV is a global set of environmental variables that will get set. |
| 4 |
; Note that all environmental variables can be seen by all connections, |
| 5 |
; so you can't have different values for different connections. |
| 6 |
[ENV] |
| 7 |
;INFORMIXSERVER => my_special_database |
| 8 |
;INFORMIXDIR => /opt/informix |
| 9 |
;ORACLE_HOME => /home/oracle |
| 10 |
|
| 11 |
; All other sections are arbitrary names for database connections. |
| 12 |
|
| 13 |
; |
| 14 |
; The context name is what will be used in other configuration files, such |
| 15 |
; as extconfig.conf and func_odbc.conf, to reference this connection. |
| 16 |
[asterisk] |
| 17 |
; |
| 18 |
; Permit disabling sections without needing to comment them out. |
| 19 |
; If not specified, it is assumed the section is enabled. |
| 20 |
enabled => no |
| 21 |
; |
| 22 |
; This value should match an entry in /etc/odbc.ini |
| 23 |
; (or /usr/local/etc/odbc.ini, on FreeBSD and similar systems). |
| 24 |
dsn => asterisk |
| 25 |
; |
| 26 |
; Username for connecting to the database. The user defaults to the context name if unspecified. |
| 27 |
;username => myuser |
| 28 |
; |
| 29 |
; Password for authenticating the user to the database. The default |
| 30 |
; password is blank. |
| 31 |
;password => mypass |
| 32 |
; |
| 33 |
; Build a connection at startup? |
| 34 |
pre-connect => yes |
| 35 |
; |
| 36 |
; What should we execute to ensure that our connection is still alive? The |
| 37 |
; statement should return a non-zero value in the first field of its first |
| 38 |
; record. The default is "select 1". |
| 39 |
;sanitysql => select 1 |
| 40 |
; |
| 41 |
; The maximum number of connections to have open at any given time. |
| 42 |
; This defaults to 1 and it is highly recommended to only set this higher |
| 43 |
; if using a version of UnixODBC greater than 2.3.1. |
| 44 |
;max_connections => 20 |
| 45 |
; |
| 46 |
; When the channel is destroyed, should any uncommitted open transactions |
| 47 |
; automatically be committed? |
| 48 |
;forcecommit => no |
| 49 |
; |
| 50 |
; How should we perceive data in other transactions within the database? |
| 51 |
; Possible values are read_uncommitted, read_committed, repeatable_read, |
| 52 |
; and serializable. The default is read_committed. |
| 53 |
;isolation => repeatable_read |
| 54 |
; |
| 55 |
; Is the backslash a native escape character? The default is yes, but for |
| 56 |
; MS SQL Server, the answer is no. |
| 57 |
;backslash_is_escape => yes |
| 58 |
; |
| 59 |
; How long (in seconds) should we attempt to connect before considering the |
| 60 |
; connection dead? The default is 10 seconds, but you may wish to reduce it, |
| 61 |
; to increase responsiveness. |
| 62 |
;connect_timeout => 10 |
| 63 |
; |
| 64 |
; When a connection fails, how long (in seconds) should we cache that |
| 65 |
; information before we attempt another connection? This increases |
| 66 |
; responsiveness, when a database resource is not working. |
| 67 |
;negative_connection_cache => 300 |
| 68 |
; |
| 69 |
; Enable query logging. This keeps track of the number of prepared queries |
| 70 |
; and executed queries as well as the query that has taken the longest to |
| 71 |
; execute. This can be useful for determining the latency with a database. |
| 72 |
; The data can be viewed using the "odbc show" CLI command. |
| 73 |
; Note that only successful queries are logged currently. |
| 74 |
;logging => yes |
| 75 |
; |
| 76 |
; Slow query limit. If a query exceeds the given amount of time (in milliseconds) |
| 77 |
; when executing then a WARNING message will be output to indicate that there |
| 78 |
; may be a problem. Note that logging must be set to "yes" for this to occur. By |
| 79 |
; default this is set to 5000 milliseconds (or 5 seconds). If you would like to |
| 80 |
; disable the WARNING message it can be set to "0". |
| 81 |
;slow_query_limit => 5000 |
| 82 |
; |
| 83 |
; Set the type of connection cache. Historically res_odbc used a stack, resulting in |
| 84 |
; a single connection being re-used frequently, whilst other connections could end up |
| 85 |
; dying. Using a queue or round-robin strategy results in all connections being re-used |
| 86 |
; and kept alive. |
| 87 |
; Each strategy has pros and cons as debated on |
| 88 |
; https://github.com/asterisk/asterisk/pull/1026. In summary, the stack results |
| 89 |
; in a small number of connections remaining "hot" on the database side which |
| 90 |
; could argumentatively maintain higher performance at the cost of longer-idle |
| 91 |
; connections being timed out from the DB side, resulting in a short CPU spike on |
| 92 |
; asterisk side when that "dead tail" is attempted to be used. The queue on the |
| 93 |
; other hand will keep the load more spread over connections, resulting in them |
| 94 |
; being kept active, avoiding the CPU spike on asterisk side to a much larger |
| 95 |
; degree, at the cost of potentially keeping more connections (which could |
| 96 |
; potentially be purged DB side) active. |
| 97 |
; The default remains a stack to be backwards compatible, setting this value to |
| 98 |
; any of rr, roundrobin or queue will result in a round-robin queue being used. |
| 99 |
;cache_type => roundrobin |
| 100 |
; |
| 101 |
; Limit the number of connections to cache. This is separate from |
| 102 |
; max_connections which is the total number of connections that open, whereas |
| 103 |
; this value specifies how many idle connections will be stored in the connection |
| 104 |
; cache. On extremely spiky loads this could be useful to limit the overall |
| 105 |
; number of connections that's kept open when the spike comes down. The default |
| 106 |
; is to not limit the cache size (thus effectively limit to max_connections). |
| 107 |
; When a returned connection would result in the cache size being exceeded, the |
| 108 |
; longest idle connection in the cache shall be dropped. |
| 109 |
; Setting this to zero will effectively disable the connection cache, setting to -1 |
| 110 |
; will set this to "infinite" (default). |
| 111 |
;cache_size => 10 |
| 112 |
|
| 113 |
[mysql2] |
| 114 |
enabled => no |
| 115 |
dsn => MySQL-asterisk |
| 116 |
username => myuser |
| 117 |
password => mypass |
| 118 |
pre-connect => yes |
| 119 |
|
| 120 |
; Certain servers, such as MS SQL Server and Sybase use the TDS protocol, which |
| 121 |
; limits the number of active queries per connection to 1. |
| 122 |
[sqlserver] |
| 123 |
enabled => no |
| 124 |
dsn => mickeysoft |
| 125 |
max_connections => 5 |
| 126 |
username => oscar |
| 127 |
password => thegrouch |
| 128 |
pre-connect => yes |
| 129 |
sanitysql => select count(*) from systables |
| 130 |
; forcecommit => no ; Default to committing uncommitted transactions? |
| 131 |
; Note: this is NOT the autocommit flag; this |
| 132 |
; determines the end result of transactions which |
| 133 |
; are not explicitly committed or rolled back. By |
| 134 |
; default, such transactions are rolled back if the |
| 135 |
; call ends without an explicit commit. |
| 136 |
; isolation => read_committed ; Isolation level; supported levels are: |
| 137 |
; read_uncommitted, read_committed, repeatable_read, |
| 138 |
; serializable. Note that not all databases support |
| 139 |
; all isolation levels (e.g. Postgres only supports |
| 140 |
; repeatable_read and serializable). See database |
| 141 |
; documentation for further information. |
| 142 |
; |
| 143 |
; Many databases have a default of '\' to escape special characters. MS SQL |
| 144 |
; Server does not. |
| 145 |
backslash_is_escape => no |
| 146 |
|
| 147 |
; |
| 148 |
; If you are having problems with concurrency, please read this note from the |
| 149 |
; mailing lists, regarding UnixODBC: |
| 150 |
; |
| 151 |
; http://lists.digium.com/pipermail/asterisk-dev/2009-February/036539.html |
| 152 |
; |
| 153 |
; In summary, try setting "Threading=2" in the relevant section within your |
| 154 |
; odbcinst.ini. |
| 155 |
; |