Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 16 total
Thread Wondering - something I don't understand about Config/DB in EDB
Fri, Jan 29 2010 3:48 AMPermanent Link

durumdara
Hi!

May you got this in email (my email system have been failed to send the mail with this content).

So... I finished with the period of writing useful things (functions) for EDB, like DeleteTable, EmptyTable, IsTableExists,
InitLocalDB, etc.

For test this I created path: "c:\d\testedb", and I copy the config file to this path.
I "managed it" with edbmanaer  (set local session), and I created a database named "THEDB" on the path "c:\d\testedb
\db".
I tested it, I created many objects in it, for example table "A".

Yesterday I tried to make my first application, that a porting of a DBISAM programme.
For this I created a folder:
"c:\d\edb_app"
and for db:
"c:\d\edb_app\db"

And I copied the config files from "c:\d\testedb" to "c:\d\edb_app".

I opened manager with this config file ("c:\d\edb_app"), and I saw the "THEDB".
I altered it, and point to "c:\d\edb_app\db".

And next I wondered so much: the DB is not reloaded - it is contained table "A". This is an empty directory!!! Without any
tables/files!!!

I migrated the old database to this dir, and I wondered again: I see the table "A" files in the directory. I never create
them!!!

So now I'm very confused, and I don't understand nothing now!!!

I write what I know about other RDBMS.

a.) DBISAM:
DataBase = folder with many tables
Structure = Hold by tables
Users, Publication, Roles = Only in server mode, in the server config.
Manager = Only one table

b.) Postgresql, InterBase:
DataBase = a folder, or set of files, or one file; with tables, and all objects except...
...Config DataBase = hold database names, paths, users, roles
Structure = Hold by database, and structure tables
Users, Publication, Roles = in Config DB
Manager = Outer product. I can register remote or local database in it to manage them. Many registration I have, so
when I want to manage anything, I only need to open the DB, and let's go.

c.) What I thought about EBD:
DataBase = folder, with table files, and structure/object files.
Users, Publication, Roles = in Config file.
Manager = This can read the config file, and can manage the databases/objects registered in config file. Restriction: only
one COnfig file (registration) managed in one moment!

BUT:
Yesterday this theory destroyed, because when I change the DB path, this don't load the database underlying in the new
path (empty, none of objects, tables)...

So please help me, because I need to re-build my ideas about this system.

Now:
We have DBISAM 3.3, every application have it's database, and we have ini file that hold the connection parameters.
We read it in start, and we set Session/DBs from this.

How we realize same thing in EDB (as we have now)?

Thanks for your help, and sorry for multiply if you got my email.

Sincerely:
  DD
Fri, Jan 29 2010 4:01 AMPermanent Link

Uli Becker
durumdara,

I couldn't follow in detail Smile- but I think you just have to
distinguish between "configuration file" and "catalog".

In order to move (or copy) a database just copy the table files AND the
catalog into the desired folder.

Then you can change the path of the database in the configuration file.
That's all.

If you just copy the catalog without the table files, all tables will be
created and are empty after the database has been opened.

Hope that helps.

Regards Uli
Fri, Jan 29 2010 7:34 AMPermanent Link

durumdara
Uli Becker wrote:
<<durumdara,
I couldn't follow in detail Smile- but I think you just have to
distinguish between "configuration file" and "catalog".
In order to move (or copy) a database just copy the table files AND the
catalog into the desired folder.
Then you can change the path of the database in the configuration file.
That's all.
If you just copy the catalog without the table files, all tables will be
created and are empty after the database has been opened.
Hope that helps.
Regards Uli>>

Hi!

Not. I don't need table, because the new database is needed in empty state.
I wondering that when I pointed to the empty database (folder without any files), the
table A appeared - what is in the older path!!!

So that meaning that "config file containing" db structure (what is wrong), or it is a bug.
Afternoon I make a test with this, and I write detail again what will happening!

Thanks:
  dd
Fri, Jan 29 2010 7:46 AMPermanent Link

"Malcolm"
durumdara wrote:

> Hi!
>
> Not. I don't need table, because the new database is needed in
> empty state.  I wondering that when I pointed to the empty database
> (folder without any files), the table A appeared - what is in the
> older path!!!
>
> So that meaning that "config file containing" db structure (what is
> wrong), or it is a bug.  Afternoon I make a test with this, and I
> write detail again what will happening!
>
> Thanks:
>    dd

durumdara

One cool result of the database structure being held in the
Configuration files is that when you attempt to open a table, if the
actual file does not exist, the Engine can and will create it for you.

So what you are seeing is what you should expect.  The table is
created (empty of course).  The table files you left behind in the
old folder are not touched.

--
Fri, Jan 29 2010 8:10 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

The structure you have with ElevateDB is shown in the pdf manual. Look for 4.1 Architecture.


In essence, unlike DBISAM where you had one set of files, there are three sets of files:

configuration (one file)
catalog (one file)
tables (lots of files)

and you have configuration - one to many catalog - one to many tables.

The catalog file MUST reside in the same directory as the table files. The configuration file can be anywhere.

The configuration file holds information such as users and databases (which are just "pointers" to directories).

The catalog file holds information about the structure of tables and associated items (eg triggers).

To copy the table definitions without data just copy the catalog file to a new empty directory. Any attempt to open one of the defined tables will cause the table files to be created if they don't exist in the directory the catalog file is in.

HTH

Roy Lambert [Team Elevate]
Fri, Jan 29 2010 8:28 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< May you got this in email (my email system have been failed to send the
mail with this content). >>

Yes, I got it.  Here's my reply:

<< Next I very wondered, because the table, named A REMAINS! >>

Where is the table "remaining" ?  In the new directory, or in the old
directory ?

<< The PostgreSQL, FireBird, MS db-s are this:
a.) Config DB:
    Hold local users, roles, name of databases.
b.) Any databases:
    User databases (for applications).
 User DataBase:
    One file, or folder, but it hold all informations, tables, indexes,
structure, objects.
Manager = PGAdmin, IBManager, VS for SQLExpress = Utility that can be
configured to point to databases which need to manage. >>

EDB is exactly the same, except for one thing:

The database catalog (edbdatabase.edbcat) in the database directory
determines if a table exists or not, and any table files that aren't on disk
are created automatically from the information in the catalog.  You can ship
just the catalog with your application, put it in a database directory, and
EDB will automatically create the table files when they are first opened.

<< I have folders. Folders containing DBs.
DB = many tables, as in DBISAM, plus any objects stored in other tables. >>

Basically it is just the catalog and any table files in an EDB database
directory.

<< Config = hold users, stores, database names, and working mode
(local/network) parameters. >>

EDB doesn't store the local or network configuration information in the
configuration file, only the users, roles, stores, databases, and jobs are
stored there.

<< When I want to make an application, I need to set it's config file, to
define the users/roles, working mode, and points to DBs I need to use.Other
things are defined in the DB. >>

Correct.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jan 29 2010 8:49 AMPermanent Link

durumdara
Hi!

To clear what happening, I show you detailed steps of a test. Possible I mistake something:

I have to applications App1, App2, and they have databases, App1 have DB1, and App2 have DB2.

1.)
I opened manager, set default session to point to:
c:\App1

2.)
I create a database, point to:
c:\App1\DB1

3.)
I create a table in it:
create table A(f1 integer, f2 varchar(30));

4.)
Then I will see this table, and it appeared in c:\App1\DB1

5.)
I close default session.

6.)
I copy the App1 configs (config, lck, log) to:
c:\App2\

7.)
I edit default session to:
c:\App2\

8.)
I open it.

9.)
I open Databases. I can see DB1 in it that points to c:\App1\DB1

10.)
I altered the DataBase DB1, and I change its path to c:\App2\DB2.
This is an empty directory.

11.)
I close the session, close the manager.

12.)
I open the manager, open the session, and I want to see DB1 (that points to empty directory - c:\App2\DB2).

13.)
I see the table A which defined in c:\App1\DB1!!!
In the c:\App2\DB2 is don't see any A.*

14.)
When I put the new rows into table A, it is appearing in c:\App2\DB2

So:

I tried to copy and old catalog and try to redirect the database to new location.
When I tried this, the older catalog's DB structure is moved into newest!!!

Possible it is a feature of the EDBManager, but is is confused me.
If we have more same projects where, databases are nearly same like each others (some tables missing), but all options
are same, I cannot copy the EDBConfig in manager, to later change only the DB path, because it is recreate the
nonexists tables in the new position...
And may it copy other objects too (I have not tried this).

I don't know it is understandable (detailed steps), or not, but this confused me.

Is this a bug or a feature of EDBManager?

If I use script for it, may I get same result? The older catalog is moved into new (empty) folder?

Thanks for your help:
  dd
Fri, Jan 29 2010 9:43 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

My suggestion, and what I've done is ignore the default session and ALWAYS create new sessions as wanted. Obviously I then continue to use the sessions I've created but I NEVER edit the default session. If you try and use the default session for several different sessions/configurations then you are going to confuse yourself.

I'm not sure just what it is you're trying to achieve (with the possible exception of madness Smiley. Do you want to have two databases, each with the same tables in them but with different data, or two different databases with two different tables or something else?

If you want two databases, each with the same tables in them but with different data then the way I'd do it is:

1. Create a session NewSession1
2. Create a database in that session and set its path to c:\App1\DB1
3. Create a session NewSession2
4. Create a database in that session and set its path to c:\App2\DB2
5. Return to NewSession1, and open the database and create whatever tables you want, without entering any data
6. Close EDBManager
7. Copy EDBDatabase.EDBCat from c:\App1\DB1 to c:\App2\DB2
8. Reopen EDBManager and start entering whatever you want

There is a slight alternative to steps 6 & 7 using EDBManager reverse engineering facility

6. Select Reverse engineer database from the menu at the side. This will create a script ion a new window.
7. Close NewSession1
8. Open NewSession2
9. Open the database
10. Run the script
11. Start entering data

Roy Lambert [Team Elevate]
Fri, Jan 29 2010 9:46 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< To clear what happening, I show you detailed steps of a test. Possible I
mistake something: >>

No, you're not mistaken.  It seems to be an issue with the database getting
flagged as modified when it shouldn't, and that is why the database catalog
is written out to the new database directory when it shouldn't be.

I'll have a fix for this in build 8.

Thanks,

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Jan 29 2010 12:54 PMPermanent Link

durumdara
Hi!

Interesting questions (from my boss) - they are reflect to this:

<<To copy the table definitions without data just copy the catalog file to a new empty directory.
Any attempt to open one of the defined tables will cause the table files to be created if they don't exist in the directory the catalog file is in.>>

1.)
When indexes are lost in DBISAM,  sometimes we can "save" only primary index on repair.
What happening when EDB index file lost (for example: deleted)? Can EDB repair it from catalog?

2.)
What happening when the catalog's structure and table structure isn't identical?
For example:
Filesystem injured in a corporation because of HDD failure.
One table destroyed, and we must replaced it with older version (from Backup).
But this table structure is different than latest, for example one field is missing from it.
Then...? Error? Ignored? Error to logfile?

Thanks for you all help!
  dd
Page 1 of 2Next Page »
Jump to Page:  1 2
Image