More InterBase connection strings than you shake a stick at!

Posted by on in Tips, Tricks and Techniques

In my recent CodeRage X talk I demonstrated many connection examples. I got thinking, how many different ones can I create that mean exactly the same thing? Here's a result of that thinking.

Let's assume you have InterBase server edition running on Windows. It could be any version of Windows. It could be any version of InterBase since InterBase 2009. It could be a 32 bit or 64 bit OS. It could be InterBase 64 bit server or InterBase 32 bit server. The name of your server is called Fred and IP Address for Fred is 1.2.3.4. You want to connect to the employee sample database included with InterBase and you have already create an alias called emp to it. Here are 31 different connection strings that would allow you to connect to the employee sample database assuming your client is on the same machine as the server and your client application has a working directory that is the same directory as your database.

  1. employee.gdb
  2. "C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  3. emp
  4. "localhost:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  5. localhost:emp
  6. "fred:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  7. fred:emp
  8. "localhost/gds_db:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  9. localhost/gds_db:emp
  10. "fred/gds_db:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  11. fred/gds_db:emp
  12. "localhost/3050:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  13. localhost/3050:emp
  14. "fred/3050:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  15. fred/3050:emp
  16. "1.2.3.4/gds_db:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  17. 1.2.3.4/gds_db:emp
  18. "1.2.3.4/3050:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  19. 1.2.3.4/3050:emp
  20. "127.0.0.1/gds_db:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  21. 127.0.0.1/gds_db:emp
  22. "127.0.0.1/3050:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  23. 127.0.0.1/3050:emp
  24. 1.2.3.4:emp
  25. 127.0.0.1:emp
  26. "1.2.3.4:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  27. "127.0.0.1:C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  28. "\\fred\C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  29. "\\localhost\C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  30. "\\1.2.3.4\C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"
  31. "\\127.0.0.1\C:\ProgramData\Application Data\Embarcadero\InterBase\gds_db\examples\database\employee.gdb"

Here's a brief comment on what each of these uniquely means:

  1. local connection (works with InterBase Desktop) with relative path
  2. local connection (works with InterBase Desktop) with complete path
  3. local connection (works with InterBase Desktop) using database alias
  4. TCP/IP connection with all defaults to local server
  5. TCP/IP connection using database alias to local server
  6. TCP/IP connection with all defaults to fred server
  7. TCP/IP connection using database alias to fred server
  8. TCP/IP connection with port alias gds_db to local server
  9. TCP/IP connection with port alias gds_db using database aiias
  10. TCP/IP connection with port alias gds_db to fred server
  11. TCP/IP connection with port alias gds_db to fred server using database alias
  12. TCP/IP connection with port number to local server
  13. TCP/IP connection with port number to local server using database alias
  14. TCP/IP connection with port number to fred server
  15. TCP/IP connection with port number to fred server using database alias
  16. TCP/IP connection using IP Address of local machine with port alias of gds_db
  17. TCP/IP connection using IP Address of local machine with port alias using database alias
  18. TCP/IP connection using IP Address of local machine with port number
  19. TCP/IP connection using IP Address of local machine with port number using database alias
  20. TCP/IP connection using IP Address of localhost with port alias
  21. TCP/IP connection using IP Address of localhost with port alias using database alias
  22. TCP/IP connection using IP Address of localhost with port number
  23. TCP/IP connection using IP Address of localhost using port number using database alias
  24. TCP/IP connection using IP Address of local machine using database alias
  25. TCP/IP connection using IP Address localhost using database alias
  26. TCP/IP connection using IP Address local machine
  27. TCP/IP connection using IP Address of localhost
  28. NetBEUI connection to Fred server
  29. NetBEUI connection to localhost server
  30. NETBEUI connection via IPAdrress of Fred server
  31. NETBEUI connection via IP Address of localhost server


About
Gold User, Rank: 36, Points: 77
Support guy since 3/18/85. It was dBASE II/III back then.

Comments

Check out more tips and tricks in this development video: