Subject Re: [firebird-support] how to connect to firebird database
Author Helen Borrie
At 10:43 AM 10/01/2010, you wrote:
>Assuming you installed using the .exe installation file onto Windows . . . and assuming D: drive is where FB is installed, and assuming the Firebird engine is actually running, the following should work:
>SQL>CREATE DATABASE 'Localhost:D:test.fdb' page_size 8192 user 'SYSDBA' masterkey'; #
>should work. Note the backslash after the D: denotes a subdirectory.

Actually, the backslash should always be included; and trying to create databases in relative path locations must be avoided, particularly in Windows, where most versions in recent times prevent you from creating user objects in Program Files. (It's a bad idea anyway!)

> If you wish to create test.fdb in a subdirectory you will need to create a subdirectory first. The above should create the *.fdb in the root directory.

Again, no. Not a good idea and won't work on many Windows platforms.

However....

> If you wish to create the file on a 'remote' computer

OR LOCAL !!

>you will need to preceed the location with the name of the computer onto which you wish to create the file,

What you mean to say is "You need to supply the full path to the location where you want the database created."

>i.e. example CREATE DATABASE 'OTHERPLACE:c:\testdirectory\test.fdb' and so on.

Hmm, "OTHERPLACE" in this example is actually a placeholder for the IP address or Hostname of a TCP/IP server. Make this hostname and IP address static for the NIC that is broadcasting to Firebird clients. To do that, make an entry in the %sysdir%\drivers\etc\hosts file. Using "OTHERPLACE" as the hostname (swap in the actual hostname), open the Hosts file in Notepad and add an entry like:

n.n.n.n OTHERPLACE # our TCP/IP host for Firebird

n.n.n.n of course must be a valid IP address in the range available to your clients.

This anchors the association of this IP address with this host across the full scope of this network. DHCP will not allocate to any other node a static address that is defined in hosts.

Again referring to John's example, you must pre-create the directory c:\testdirectory before you attempt to create the database. Firebird does NOT create directories for you. Do not share this directory on the network and do not remap it.

John could also have said, "You need to supply the alias to the database". The file aliases.conf allows you to define an alias for every every database path your clients will be allowed to access. For the alias you supply not just the path but also the file name of the database. The file does not need to exist yet...thus, you can prescribe the creation of the database and subsequently use the alias in the CREATE DATABASE statement, e.g.,

-- in aliases.conf:
ourdb = c:\testdirectory\test.fdb

-- in the CREATE DATABASE statement:
CREATE DATABASE 'OTHERPLACE:ourdb' page_size 8192 user 'SYSDBA' password 'gobblede'


>Would suggest you download, print and study the excellent Quick Start Guide and Helen Borrie's Migration and Installation. Also, you might want to consider using something like WFSQL which you can find on Firebird's wedsite under administrative tools.

I'm not familiar with a tool called WFSQL, but we don't have an "administrative tools" section on the Firebird website. Perhaps you are thinking of the IBPhoenix website, which does.

However, for those wanting a free admin tool, the open source FlameRobin serves all the basic needs, is up to date with Firebird releases and is cross-platform. You can link to the FlameRobin website and downloads from the left-side menu of the main page at http://firebirdsql.org

>Much easier to use than isql that comes with Firebird. Found a listing of error codes for Firebird 1.5 - don't have site handy, just do a web search for Firebird error codes or similar.

It's easier than that. For the error codes listings and any of the Docs referred to, just go to the Documentation Index at the Firebird main website (see link above, and pick Documentation from the top menu!)

./heLen