What's a connection string?


Connection string is a string containing server name (hostname or IP address), TCP/IP port and a path to database or database alias. For example, if you are connecting to database /db/mydb.fdb on a Linux Firebird server at IP address 192.168.0.11, you can use a connection string like this:

192.168.0.11:/db/mydb.fdb

You can also write the server hostname instead of IP address:

MYSERVER:/db/mydb.fdb

If the server is Windows, use drive letters as well:

192.168.0.11:C:\db\mydb.fdb
MYSERVER:C:\db\mydb.fdb

You can also use aliases instead of database path:

192.168.0.11:mydb
MYSERVER:mydb

If the server uses some TCP/IP port other than the default 3050, you need to add that as well. For example, if the port is 3051:

192.168.0.11/3051:C:\db\mydb.fdb
192.168.0.11/3051:mydb
MYSERVER/3051:/db/mydb.fdb
MYSERVER/3051:mydb

Beside the port name, you can also use the service name, which is gds_db by default:

192.168.0.11/gds_db:C:\db\mydb.fdb
192.168.0.11/gds_db:mydb
MYSERVER/gds_db:/db/mydb.fdb
MYSERVER/gds_db:mydb

Service name is basically an alias for port, and is stored in services file on your system. See FAQ #227 for more details.

Beside TCP/IP you can also connect via Named Pipes (a.k.a. NetBEUI or WNET) protocol. In that case, the connection string looks like this:

\\MYSERVER\C:\db\mydb.fdb
\\MYSERVER@gds_db\C:\db\mydb.fdb


On Windows, you can also connect to server on local machine using local transport protocol. In Firebird 2.0, implementation has switched from IPServer to XNET. In this case, the connection string is supplied without the hostname prefix, in the same way as Firebird embedded is used.

C:/db/mydb.fdb



Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous