Subject | Re: [firebird-support] Statement failed, SQLCODE = -904 |
---|---|
Author | Helen Borrie |
Post date | 2008-01-18T06:02:50Z |
At 03:35 PM 18/01/2008, you wrote:
CREATE DATABASE is one SQL command but it involves multiple actions. First the server has to create the *file* where the database is to live and write some data that will become the "database header page". So far, this is a file operation only.
Then, once this headered file exists, it has to connect to it as a database.
So - while the filesystem-only part at the beginning is possible using a relative file location, a full path to the database file is required.
In any case, it is a very bad idea to create databases in Firebird's \bin\ directory. So make an area of your hard disk where databases will live. Let's suppose you create a directory named "data" on drive C for this.
That makes the file-path for the new database 'C:\data\bbb.fdb'
Now, if you are using Superserver *and* you are running isql in a native command shell (not in a remote desktop client shell) you can create your database this way:
SQL> CREATE DATABASE 'C:\data\bbb.fdb';
If you still get 'unavailable database' then either you are running Classic server or isql is running in a RDT shell. Either way, you must supply also the host name (or IP address) of the machine where the server runs and specify the user name and password of the database owner. So let's say your machine's network node name is elwinsbox and your shell is an RDT client:
Using TCP/IP:
SQL> CREATE DATABASE 'elwinsbox:C:\data\bbb.fdb' user 'SYSDBA' password 'whatever';
Using WNET:
SQL> CREATE DATABASE '\\C:\data\bbb.fdb' user 'SYSDBA' password 'whatever';
With Classic and a native command shell you can use the local loopback server, "localhost" as the hostname (TCP/IP only):
SQL> CREATE DATABASE 'localhost:C:\data\bbb.fdb' user 'SYSDBA' password 'whatever';
Anything else, you would need to provide better information about your environment.
Also, use the release notes and the Quick Start Guide as your reference. The examples in the IB 6 manuals are very poor and often just *wrong*; and they don't know about Classic on Windows at all.
./heLen
>Hi,One problem here, possible two (assuming the Firebird service is running, of course. Check that by consulting the Services applet.)
>I try to create a database in my local database by typing following,
>but keep getting errors.
>C:\netchem\engine\DBSchema>..\..\vendor\Firebird\Server\bin\isql -u
>sysdba -p masterkey
>Use CONNECT or CREATE DATABASE to specify a database
>SQL> CREATE DATABASE 'bbb.fdb';
>Statement failed, SQLCODE = -904
>
>unavailable database
>
>
>Any one knows the why?
>(I pretty sure the database server is ready and running. I use the
>IBConsole to verify that by creating a new database.)
CREATE DATABASE is one SQL command but it involves multiple actions. First the server has to create the *file* where the database is to live and write some data that will become the "database header page". So far, this is a file operation only.
Then, once this headered file exists, it has to connect to it as a database.
So - while the filesystem-only part at the beginning is possible using a relative file location, a full path to the database file is required.
In any case, it is a very bad idea to create databases in Firebird's \bin\ directory. So make an area of your hard disk where databases will live. Let's suppose you create a directory named "data" on drive C for this.
That makes the file-path for the new database 'C:\data\bbb.fdb'
Now, if you are using Superserver *and* you are running isql in a native command shell (not in a remote desktop client shell) you can create your database this way:
SQL> CREATE DATABASE 'C:\data\bbb.fdb';
If you still get 'unavailable database' then either you are running Classic server or isql is running in a RDT shell. Either way, you must supply also the host name (or IP address) of the machine where the server runs and specify the user name and password of the database owner. So let's say your machine's network node name is elwinsbox and your shell is an RDT client:
Using TCP/IP:
SQL> CREATE DATABASE 'elwinsbox:C:\data\bbb.fdb' user 'SYSDBA' password 'whatever';
Using WNET:
SQL> CREATE DATABASE '\\C:\data\bbb.fdb' user 'SYSDBA' password 'whatever';
With Classic and a native command shell you can use the local loopback server, "localhost" as the hostname (TCP/IP only):
SQL> CREATE DATABASE 'localhost:C:\data\bbb.fdb' user 'SYSDBA' password 'whatever';
Anything else, you would need to provide better information about your environment.
Also, use the release notes and the Quick Start Guide as your reference. The examples in the IB 6 manuals are very poor and often just *wrong*; and they don't know about Classic on Windows at all.
./heLen