| 1 |
------------------ |
| 2 |
Connection strings |
| 3 |
------------------ |
| 4 |
|
| 5 |
Connection string is a local or remote path to the database being attached. |
| 6 |
|
| 7 |
The legacy syntax (supported by all Firebird versions) is the following: |
| 8 |
|
| 9 |
For TCP (aka INET) protocol: |
| 10 |
|
| 11 |
<host> [ / <port>] : <file path to database or alias> |
| 12 |
|
| 13 |
For named pipes (aka NetBEUI, aka WNET) protocol: |
| 14 |
|
| 15 |
\\ <host> [ @ <port>] \ <file path to database or alias> |
| 16 |
|
| 17 |
For local connections as simple as: |
| 18 |
|
| 19 |
<file path to database or alias> |
| 20 |
|
| 21 |
If host name is omitted, local connection is implied. Depending on settings, |
| 22 |
platform and Firebird version, it could be performed via either the embedded |
| 23 |
engine or XNET (shared memory) protocol or TCP localhost loopback. |
| 24 |
|
| 25 |
Examples: |
| 26 |
|
| 27 |
Connect via TCP using database name: |
| 28 |
|
| 29 |
192.168.0.11:/db/mydb.fdb |
| 30 |
192.168.0.11:C:\db\mydb.fdb |
| 31 |
myserver:C:\db\mydb.fdb |
| 32 |
localhost:/db/mydb.fdb |
| 33 |
|
| 34 |
Connect via TCP using database alias: |
| 35 |
|
| 36 |
192.168.0.11:mydb |
| 37 |
myserver:mydb |
| 38 |
localhost:mydb |
| 39 |
|
| 40 |
Connect via TCP using non-default port 3051: |
| 41 |
|
| 42 |
192.168.0.11/3051:C:\db\mydb.fdb |
| 43 |
192.168.0.11/3051:mydb |
| 44 |
myserver/3051:/db/mydb.fdb |
| 45 |
localhost/3051:/db/mydb.fdb |
| 46 |
myserver/3051:mydb |
| 47 |
localhost/3051:mydb |
| 48 |
|
| 49 |
Connect via TCP using non-default service name: |
| 50 |
|
| 51 |
192.168.0.11/fb_db:C:\db\mydb.fdb |
| 52 |
192.168.0.11/fb_db:mydb |
| 53 |
localhost/fb_db:/db/mydb.fdb |
| 54 |
myserver/fb_db:/db/mydb.fdb |
| 55 |
myserver/fb_db:mydb |
| 56 |
localhost/fb_db:mydb |
| 57 |
|
| 58 |
Connect via named pipes: |
| 59 |
|
| 60 |
\\myserver\C:\db\mydb.fdb |
| 61 |
\\myserver@fb_db\C:\db\mydb.fdb |
| 62 |
|
| 63 |
Local connection: |
| 64 |
|
| 65 |
/db/mydb.fdb |
| 66 |
C:\db\mydb.fdb |
| 67 |
mydb |
| 68 |
|
| 69 |
Additionally, Firebird 3.0 introduces generalized URL-like syntax for |
| 70 |
connection strings: |
| 71 |
|
| 72 |
[ <protocol> : // [ <host> [ : <port> ] ] ] / <file path to database or alias> |
| 73 |
|
| 74 |
Where protocol is one of: INET (means TCP), WNET (means named pipes) or XNET |
| 75 |
(means shared memory). |
| 76 |
|
| 77 |
Examples: |
| 78 |
|
| 79 |
Connect via TCP using database name: |
| 80 |
|
| 81 |
inet://192.168.0.11//db/mydb.fdb |
| 82 |
inet://192.168.0.11/C:\db\mydb.fdb |
| 83 |
inet://myserver/C:\db\mydb.fdb |
| 84 |
inet://localhost//db/mydb.fdb |
| 85 |
|
| 86 |
Connect via TCP using database alias: |
| 87 |
|
| 88 |
inet://192.168.0.11/mydb |
| 89 |
inet://myserver/mydb |
| 90 |
inet://localhost/mydb |
| 91 |
|
| 92 |
Connect via TCP using non-default port 3051: |
| 93 |
|
| 94 |
inet://192.168.0.11:3051/C:\db\mydb.fdb |
| 95 |
inet://192.168.0.11:3051/mydb |
| 96 |
inet://myserver:3051//db/mydb.fdb |
| 97 |
inet://localhost:3051//db/mydb.fdb |
| 98 |
inet://myserver:3051/mydb |
| 99 |
inet://localhost:3051/mydb |
| 100 |
|
| 101 |
Connect via TCP using non-default service name: |
| 102 |
|
| 103 |
inet://192.168.0.11:fb_db/C:\db\mydb.fdb |
| 104 |
inet://192.168.0.11:fb_db/mydb |
| 105 |
inet://localhost:fb_db//db/mydb.fdb |
| 106 |
inet://myserver:fb_db//db/mydb.fdb |
| 107 |
inet://myserver:fb_db/mydb |
| 108 |
inet://localhost:fb_db/mydb |
| 109 |
|
| 110 |
The "inet" protocol can be replaced by "inet4" or "inet6" to restrict client |
| 111 |
to IPv4 or IPv6 addresses corresponding to supplied name ("inet" protocol |
| 112 |
tries all addresses in the order determined by OS): |
| 113 |
|
| 114 |
inet4://myserver/mydb |
| 115 |
inet6://myserver/mydb |
| 116 |
|
| 117 |
Connect via named pipes: |
| 118 |
|
| 119 |
wnet://myserver/C:\db\mydb.fdb |
| 120 |
wnet://myserver:fb_db/C:\db\mydb.fdb |
| 121 |
|
| 122 |
Loopback connection via TCP: |
| 123 |
|
| 124 |
inet:///db/mydb.fdb |
| 125 |
inet://C:\db\mydb.fdb |
| 126 |
inet://mydb |
| 127 |
|
| 128 |
Loopback connection via named pipes: |
| 129 |
|
| 130 |
wnet://C:\db\mydb.fdb |
| 131 |
wnet://mydb |
| 132 |
|
| 133 |
Local connection via shared memory: |
| 134 |
|
| 135 |
xnet://C:\db\mydb.fdb |
| 136 |
xnet://mydb |
| 137 |
|
| 138 |
Local (embedded by default) connection: |
| 139 |
|
| 140 |
/db/mydb.fdb |
| 141 |
C:\db\mydb.fdb |
| 142 |
mydb |
| 143 |
|
| 144 |
If protocol and host name are omitted, local connection is implied. Depending on settings, |
| 145 |
it could be performed via either the embedded engine or XNET (shared memory) protocol |
| 146 |
or TCP localhost loopback. |
| 147 |
|
| 148 |
On the server side, default provider configuration is: |
| 149 |
|
| 150 |
Providers = Remote, Engine12, Loopback |
| 151 |
|
| 152 |
It means that if the remote provider fails to match the connection string (because of missing |
| 153 |
protocol / host parts), then the embedded engine handles the hostless connection. If you need |
| 154 |
to connect locally using a specific transport protocol, please specify: |
| 155 |
|
| 156 |
inet://<file path to database or alias> |
| 157 |
or |
| 158 |
wnet://<file path to database or alias> |
| 159 |
or |
| 160 |
xnet://<file path to database or alias> |
| 161 |
|
| 162 |
Note: WNET (named pipes) and XNET (shared memory) protocols are available on Windows only. |
| 163 |
|