Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 10 total |
Tables missing after Migrate |
Tue, Sep 2 2008 10:07 PM | Permanent Link |
Pierre du Plessis | Hi There,
I have the following migrate code, which seems to work fine. Looking inside the folders, all tables are in the Elevate DB path, but when I use Elevate DB Manager the database is there, but the Views and tables are missing. The User that got created at migration time is also there. Here's the code: =========================================== procedure TFormMigrate.ConvertToElevateDB(DbISAMPath, EDBPath, newDB: String); var NewDBPath: String; begin if FileExists(EDBPath + 'edbmigratedbisam4.dll') then begin NewDBPath := EDBPath+newDB; if not DirectoryExists(NewDBPath) or (DirectoryExists(NewDBPath) and (MessageDlg('Hawkeye 2009 database exists, Replace?',mtConfirmation,[mbNo, mbYes],0)=mrYes)) then begin FilesToDelete(NewDBPath, '*.EDB???'); // EDBTbl, EDBIdx, EDBblb if FileExists(EDBPath + 'EDBConfig.EDBLog') then DeleteFile(EDBPath + 'EDBConfig.EDBLog'); if FileExists(EDBPath + 'EDBConfig.EDBCfg.Old') then DeleteFile(EDBPath + 'EDBConfig.EDBCfg.Old'); if FileExists(EDBPath + 'EDBConfig.EDBCfg') then DeleteFile(EDBPath + 'EDBConfig.EDBCfg'); if FileExists(EDBPath + 'EDBConfig.EDBLck') then DeleteFile(EDBPath + 'EDBConfig.EDBLck'); with Session do begin LocalConfigPath := EDBPath; try Execute('CREATE MIGRATOR "DBISAM4" '+ 'MODULE "edbmigratedbisam4" '+ 'DESCRIPTION ''DBISAM 4 Migrator'''); except end; end; with Session do Execute(format('CREATE DATABASE %s PATH ''%s''',[newDB, NewDBPath])); with NewDatabase do begin DatabaseName := newDB; Database := newDB; Execute('MIGRATE DATABASE FROM "DBISAM4" '+ format('USING DatabaseDirectory = ''%s'', ',[DbISAMPath])+ 'TablePasswords = ''P123DR'' WITH DATA'); Execute('ALTER TABLE "Medication" '+ 'ALTER COLUMN "ID" AS INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) NOT NULL'); Execute('CREATE VIEW "Sire" AS '+ 'SELECT P.*, VC.COLOR as COLOR, VS.STRAIN as STRAIN, VST.STATUS as STATUS '+ 'FROM Pigeon P '+ 'JOIN validcolor VC on P.COLOR_ID=VC.ID '+ 'JOIN validstrain VS on P.STRAIN_ID=VS.ID '+ 'JOIN validstatus VST on P.STATUS_ID=VST.ID '+ 'WHERE SEX=''Cock'' '+ 'ORDER BY P.ID '+ 'DESCRIPTION ''All male birds in the database'''); Execute('CREATE VIEW "Dam" AS '+ 'SELECT P.*, VC.COLOR as COLOR, VS.STRAIN as STRAIN, VST.STATUS as STATUS '+ 'FROM Pigeon P '+ 'JOIN validcolor VC on P.COLOR_ID=VC.ID '+ 'JOIN validstrain VS on P.STRAIN_ID=VS.ID '+ 'JOIN validstatus VST on P.STATUS_ID=VST.ID '+ 'WHERE SEX=''Hen'' '+ 'ORDER BY P.ID '+ 'DESCRIPTION ''All Hens in the database'''); end; with Session do begin Execute('CREATE USER "Hawkeye" PASSWORD ''P123DR'' DESCRIPTION ''Hawkeye Login User'''); Execute('GRANT "Administrators" TO "Hawkeye"'); Execute('ALTER USER "Administrator" PASSWORD ''P123DR'''); Execute('DROP MIGRATOR "DBISAM4"'); end; Session.CloseDatabase(NewDataBase); Session.Close; ProgressBar.Position := 0; end; end else MessageDlg('migrator code is missing', mtError, [mbOK], 0); end; procedure TFormMigrate.BitBtn1Click(Sender: TObject); var DbISAMPath, EDBPath, DataBase: string; begin EDBPath := IncludeTrailingBackslash(GetSpecialFolderPath(CSIDL_COMMON_APPDATA))+'Comproware\'; DbISAMPath := IncludeTrailingBackslash(ExtractFilePath(Application.ExeName))+'data4\'; ConvertToElevateDB(DbISAMPath, EDBPath, 'Hawkeye'); end; =============================================================== The Path for the Config files are: C:\Documents and Setting\All Users\Comproware And the DataBase is in a subdirectory \Hawkeye As mentioned, even though the database exists there are no tables and Views. Kind regards Pierre |
Wed, Sep 3 2008 2:55 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Pierre
When I've had the "no tables" problem its because always been because the source database has been incorrect. So 1) have you tried in EDBManager and 2) how long does the migration seem to take? If its incredibly fast its almost guaranteed to be the wrong source path. Roy Lambert |
Wed, Sep 3 2008 4:28 AM | Permanent Link |
Pierre du Plessis | Hi Roy,
> 1) have you tried in EDBManager and Yes, it migrated the data properly 2) how long does the migration seem to take? If its incredibly fast its almost guaranteed to be the wrong source path. Using code, it takes time, the ProgresBar progresses slow on some of the bigger tables. When browsing the destination folder (new EDB database" All the tables are there.... Then if I use EDB Manager, I can connect, the database are there, the users are created, but nothing else. Awaiting your response/questions if I can clarify more... Many thanks, Pierre |
Wed, Sep 3 2008 3:20 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Pierre,
<< I have the following migrate code, which seems to work fine. Looking inside the folders, all tables are in the Elevate DB path, but when I use Elevate DB Manager the database is there, but the Views and tables are missing. The User that got created at migration time is also there. >> Did you step through the code in the Delphi debugger to ensure that everything is getting executed as you expect ? I don't see anything obvious wrong with your code, so I suspect that it's something less apparent that the debugger might be able to help with. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Sep 3 2008 6:35 PM | Permanent Link |
Pierre du Plessis | Hi Tim,
> Did you step through the code in the Delphi debugger to ensure that > everything is getting executed as you expect ? I don't see anything obvious > wrong with your code, so I suspect that it's something less apparent that > the debugger might be able to help with. Yes, all steps are processed fine. What's strange is that I can alter the Medication table, which suggests it's made it to the new EDB. Have I assignened these values correctly?: ==================== with NewDatabase do begin DatabaseName := newDB; Database := newDB; ==================== newDB only contains the name of the New database and not the full path. I just thought that maybe the database has been migrated to another location, which EDB Manager can't pick up, or something... If you like, I can put a detailed word document together that has screen shots of what I'm doing, perhaps you can see where I've gone wrong? Many Thanks, Pierre |
Thu, Sep 4 2008 2:35 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Pierre,
<< Yes, all steps are processed fine. What's strange is that I can alter the Medication table, which suggests it's made it to the new EDB. Have I assignened these values correctly?: >> Yes, although you aren't assigning a SessionName for the database. Are you setting the TEDBEngine.UseLocalSessionEngineSettings property to True ? -- Tim Young Elevate Software www.elevatesoft.com |
Mon, Sep 8 2008 1:42 AM | Permanent Link |
Pierre du Plessis | "Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:
> Yes, although you aren't assigning a SessionName for the database. Are you > setting the TEDBEngine.UseLocalSessionEngineSettings property to True ? Hi Tim, The Session name has been set a design time, and the TEDBEngine.UseLocalSessionEngineSettings is set to true. See the attached PDF. Kind regards, Pierre Attachments: DBIsam to Elevate DB migration issue.pdf |
Mon, Sep 8 2008 1:56 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Pierre,
<< The Session name has been set a design time, and the TEDBEngine.UseLocalSessionEngineSettings is set to true. See the attached PDF. >> If UseLocalSessionEngineSettings is set to True, then you need to make sure that the LocalConfigPath for the TEDBSession that you're using is set to the proper configuration path. Also, your screen shots of the EDB Manager are missing one important piece - what is the path for the Hawkeye database when you click on it in the EDB Manager ? -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Sep 9 2008 12:35 AM | Permanent Link |
Pierre du Plessis | Hi Tim,
I have manage to resolve the issue. On the "Local Customizations tab, I had "Hawkeye" as the catalog name. The reason I used this name is because of the message: "The catalog name can be any name that you wish." This is not true, if the migration has been done by code with a different catalog name. In the code, the default was used, namely "EDBDatabase". Once I changed this, the tables and views are there... Thanks very much for your help. Our discussions let me to the find. Regards, Pierre |
Tue, Sep 9 2008 2:30 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Pierre,
<< I have manage to resolve the issue. On the "Local Customizations tab, I had "Hawkeye" as the catalog name. The reason I used this name is because of the message: "The catalog name can be any name that you wish." This is not true, if the migration has been done by code with a different catalog name. In the code, the default was used, namely "EDBDatabase". Once I changed this, the tables and views are there... >> Darn, I completely missed that in your screen shot. I need to look closer next time. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, May 4, 2024 at 09:18 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |