Subject | Re: [firebird-support] Trouble establishing a connection to Firebird database files. |
---|---|
Author | Helen Borrie |
Post date | 2017-11-28T04:21Z |
Tuesday, November 28, 2017, 12:06:27 PM, Justis wrote:
shell and go to the Firebird root directory.
Then do
gstat -h d:\path\to\your\database
where d:\path\to\your\database is the absolute (i.e., not relative)
file path to your database
If you do that right, and the database was created or restored under
Fb 3, you should see output similar to this:
C:\Programs64\Firebird_3_0>gstat -h c:\programs64\firebird_3_0\examples\empbuild\employee.fdb
Database "C:\PROGRAMS64\FIREBIRD_3_0\EXAMPLES\EMPBUILD\EMPLOYEE.FDB"
Database header page information:
Flags 0
Generation 168
System Change Number 0
Page size 8192
ODS version 12.0
Oldest transaction 160
Oldest active 161
Oldest snapshot 161
Next transaction 161
Sequence number 0
Next attachment ID 21
Implementation HW=AMD/Intel/x64 little-endian OS=Windows CC=MSVC
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date Mar 21, 2017 10:15:35
Attributes
Variable header data:
*END*
If it was created or restored under an older Firebird, you will see
this:
C:\Programs64\Firebird_3_0>gstat -h c:\programs64\firebird_2_5\examples\empbuild\employee.fdb
Wrong ODS version, expected 12, encountered 11
ODS means "on-disk structure". Each major verson (1.0, 1,5, 2.0, 2.1,
2.5, 3.0, 4.0) has its own ODS:
ODS 10.0 ~~ Fb 1.0 ODS 10.1 ~~ Fb 1.5
ODS 11.0 ~~ Fb 2.0 ODS 11.1 ~~ Fb 2.1
ODS 11.2 ~~ Fb 2.5 ODS 12.0 ~~ Fb 3.0
So, take note of the 'encountered' ODS if you get that message, as it
will tell you what version of Fb you need to install instead.
(Actually, this just revealed a bug in Fb3's gstat. It should have
reported '11.2', not '11'.)
BTW, Fb 2.5 and below *can* attach to databases with older ODS, so if
Fb 3 gives you the Wrong ODS version error, try installing V.2.5, as
its gstat -h and iqsl tools will read 11.0, 11.1 and 11.2.
However, if you need to make a gbak backup of your database, in order
ro restore it as ODS 12 under Fb 3, you will need to run the backup on
the actual Firebird server version that created it.
semi-colon, which is isql's line terminator. But that is not a valid
CONNECT statement you have there, anyway, even with the semi-colon.
If you supply the user and/or password arguments to the CONNECT
statement, the syntax is:
SQL> CONNECT 'localhost:employee' USER sysdba PASSWORD 'masterkey';
Note that employee is an alias for
c:\programs64\firebird_3_0\examples\empbuild\employee.fdb. Read up
about database aliases - they are very friendly to have around.
As you did it, in Fb 3, with an embedded connect, you don't need
the PASSWORD argument at all. You will need the USER argument as,
otherwise, you will be logged in under your Windows user name, which
may not, at this point, have the permissions you need to access
objects in the database.
weird, anyway.
Try
"jdbc:firebirdsql://localhost:T:/Database/ejdb.fdb"
But it can't work if drive T: is not a physical drive wired onto the
server that hosts Firebird. What I'm saying is that, if you have only
drives C:, E: and F: on the machine, your databases must be on the
native path of one or more of those, not on some mapped network
address. So if you have drive T: mapped to some network or local
address then drive T: is NOT a phsysical drive.
May I suggest that, given your uncertainty about the properties of
your databases, you uninstall Fb 3 and install v.2.5?
And don't try to run before you can walk. Use isql or some Firebird-dedicated
third-party tool, rather than one from "out there" that treats all
database engines as created equal.
HB
>I’m running firebird 3.0; I’m not sure what version of firebird the database files were generated with.You can find out, using another command line tool. Open a command
shell and go to the Firebird root directory.
Then do
gstat -h d:\path\to\your\database
where d:\path\to\your\database is the absolute (i.e., not relative)
file path to your database
If you do that right, and the database was created or restored under
Fb 3, you should see output similar to this:
C:\Programs64\Firebird_3_0>gstat -h c:\programs64\firebird_3_0\examples\empbuild\employee.fdb
Database "C:\PROGRAMS64\FIREBIRD_3_0\EXAMPLES\EMPBUILD\EMPLOYEE.FDB"
Database header page information:
Flags 0
Generation 168
System Change Number 0
Page size 8192
ODS version 12.0
Oldest transaction 160
Oldest active 161
Oldest snapshot 161
Next transaction 161
Sequence number 0
Next attachment ID 21
Implementation HW=AMD/Intel/x64 little-endian OS=Windows CC=MSVC
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date Mar 21, 2017 10:15:35
Attributes
Variable header data:
*END*
If it was created or restored under an older Firebird, you will see
this:
C:\Programs64\Firebird_3_0>gstat -h c:\programs64\firebird_2_5\examples\empbuild\employee.fdb
Wrong ODS version, expected 12, encountered 11
ODS means "on-disk structure". Each major verson (1.0, 1,5, 2.0, 2.1,
2.5, 3.0, 4.0) has its own ODS:
ODS 10.0 ~~ Fb 1.0 ODS 10.1 ~~ Fb 1.5
ODS 11.0 ~~ Fb 2.0 ODS 11.1 ~~ Fb 2.1
ODS 11.2 ~~ Fb 2.5 ODS 12.0 ~~ Fb 3.0
So, take note of the 'encountered' ODS if you get that message, as it
will tell you what version of Fb you need to install instead.
(Actually, this just revealed a bug in Fb3's gstat. It should have
reported '11.2', not '11'.)
BTW, Fb 2.5 and below *can* attach to databases with older ODS, so if
Fb 3 gives you the Wrong ODS version error, try installing V.2.5, as
its gstat -h and iqsl tools will read 11.0, 11.1 and 11.2.
However, if you need to make a gbak backup of your database, in order
ro restore it as ODS 12 under Fb 3, you will need to run the backup on
the actual Firebird server version that created it.
>I’m using the JDBC driver to connect from InfoCaptor.https://gyazo.com/b122c8c6de54be1d07a5240dc65c4ff6
>When using the ISQL tool to try and connect, this is what I see:
>I don’t even get an error.It means neither. The CON> prompt there means isql is waiting for a
> I’m not sure if that means the connection was successful or unsuccessful.
semi-colon, which is isql's line terminator. But that is not a valid
CONNECT statement you have there, anyway, even with the semi-colon.
If you supply the user and/or password arguments to the CONNECT
statement, the syntax is:
SQL> CONNECT 'localhost:employee' USER sysdba PASSWORD 'masterkey';
Note that employee is an alias for
c:\programs64\firebird_3_0\examples\empbuild\employee.fdb. Read up
about database aliases - they are very friendly to have around.
As you did it, in Fb 3, with an embedded connect, you don't need
the PASSWORD argument at all. You will need the USER argument as,
otherwise, you will be logged in under your Windows user name, which
may not, at this point, have the permissions you need to access
objects in the database.
>I was attempting to follow this tutorial:3050 is the default port so you don't need it. But that URI looks
>https://www.firebirdsql.org/pdfmanual/html/isql-connect-database.html
>When I try and connect with the same credentials with InfoCaptor via
>the JDBC driver, the error I get is simply “null”.
>The JDBC url I’m using is
>“jdbc:firebirdsqlLlocalhost/3050:T:/Database/ejdb.fdb”. And the user
>and password are the same as in the above screenshot.
weird, anyway.
Try
"jdbc:firebirdsql://localhost:T:/Database/ejdb.fdb"
But it can't work if drive T: is not a physical drive wired onto the
server that hosts Firebird. What I'm saying is that, if you have only
drives C:, E: and F: on the machine, your databases must be on the
native path of one or more of those, not on some mapped network
address. So if you have drive T: mapped to some network or local
address then drive T: is NOT a phsysical drive.
May I suggest that, given your uncertainty about the properties of
your databases, you uninstall Fb 3 and install v.2.5?
And don't try to run before you can walk. Use isql or some Firebird-dedicated
third-party tool, rather than one from "out there" that treats all
database engines as created equal.
HB