Toad World® Forums

ReverseUsingExistingAlias.js: Database unavailable

Hello, I’m trying to follow the example “ReverseUsingExistingAlias.js” from the TDM Help.

During the call “Alias.REDataMigrator.LoadObjects()” I get the message “Database unavailable” in the message explorer.

When I use the same alias to do the reverse engineering interactively, TDM has no problems accessing the database though.

How do I find out what the problem is connecting to the database from a script?

Thanks

(TDM 4.3.3.6)

Hi,

We will test the behavior and I will update you soon.

Thank you!

Lukas

Hi,

You will need to make slight changes of function REByAlias(Alias) as follows:

function REByAlias(Alias)
{
var REDataMigrator = Alias.REDataMigrator;
REDataMigrator.InitiateREDataMigrator();
REDataMigrator.InitObjects();
var List = Alias.REStruct.Tables;
var i;

//Select some objects to RE, only example
for (i=0;i<List.Count;i++)
{
List.GetObject(I).Selected = true;
}

Alias.REDataMigrator.REDataProvider.OpenConnection();//NEW
Alias.REDataMigrator.LoadObjects();
Alias.REDataMigrator.REDataProvider.CloseConnection();//NEW
if (Alias.REStruct.Model!=null)
{
return Alias.REStruct.Model;
}
else
{
return null;
}
}

We will repair the examples in Help to reflect current behavior.

Regards,

Lukas

Thanks for the suggestion! This does make the “Database unavailable” message go away and run through the reverse engineering. However, I end up with with only tablespaces and directories reverse engineered, no tables etc. The list returned from Alias.REStruct.Tables has zero objects in it while the database has 67 tables. What else might I need to do in order to reverse engineer my tables? (When using the same alias for manual RE, I get all expected objects)

Thanks!

Hi,

Sorry for incomplete solution! REcently we made some speed improvements and they caused that scripts need changes.

Script to load tables/objects correctly:

function REByAlias(Alias)
{
var REDataMigrator = Alias.REDataMigrator;
REDataMigrator.InitiateREDataMigrator();
REDataMigrator.LoadObjectFamilies();//NEW FOR ORACLE
REDataMigrator.InitObjects();
var List = Alias.REStruct.Tables;
var i;

//Select some objects to RE, only example
for (i=0;i<List.Count;i++)
{
List.GetObject(I).Selected = true;
}

Alias.REDataMigrator.REDataProvider.OpenConnection();//NEW
Alias.REDataMigrator.LoadObjects();
Alias.REDataMigrator.REDataProvider.CloseConnection();//NEW
if (Alias.REStruct.Model!=null)
{
return Alias.REStruct.Model;
}
else
{
return null;
}
}

Regards,

Lukas