Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Installing ElevateDB Applications
Mon, Jun 29 2009 2:43 PMPermanent Link

Pete Hollyer
I assumed that the "normal" dotNet methodology would work...Where DLL's merely put in the APplication Path are logically found...and it all seems
to work except the Database.  In my research here on the group...there is this thing called the Catalog with the database...which is required
inorder for the application to find/read the database...and inbedded in that is the Path to the Database...but when folks install an application they
can install it anywhere in their network or pc...so how do we "on-the-fly" alter this catalog to point it at the database path where the user laid
down the application????

And boy do I hope your answer does NOT include the registry..I'm trying to get away from the registry....

Pete
Mon, Jun 29 2009 7:08 PMPermanent Link

Pete Hollyer
Tim I've tracked into other threads and I guess I need to alter the database path...
So here is my code

                   //Build Connection
                   EDBConnectionStringBuilder csb = new EDBConnectionStringBuilder();
                   csb.Name = "ListBuilderConnection";
                   csb.Description = "ListBuilder Connection Object";
                   csb.Type = "LOCAL";
                   csb.ConfigPath = WorkAppPath.AppPath + "\\LBDatabase";
                   csb.Database = "ListBuilder";
                   csb.UID = "Administrator";
                   csb.PWD = "EDBDefault";
                   EDBCCon = new EDBConnection(csb.ConnectionString);

                   EDBCCon.Open();

                   //Alter Database Path to point to Databases
                   EDBCommand dbCommand = new EDBCommand();
                   string SQL = " ALTER DATABASE ListBuilder PATH '" + WorkAppPath.DBPath + "'";
                   dbCommand = new EDBCommand(SQL, EDBCCon);
                   dbCommand.ExecuteNonQuery();

This returns Error 300 "Cannot lock the database ListBuilder for exclusive access"
Tue, Jun 30 2009 1:55 PMPermanent Link

Pete Hollyer

Never mind...I resolved the problem
I was missing the  EDBCCon.ChangeDatabase("Configuration");  Connection parameter


This works like a champ:

           EDBCCon.Open();
           EDBCCon.ChangeDatabase("Configuration");
           EDBCommand dbCommand = new EDBCommand();
           string SQL = " ALTER DATABASE ListBuilder PATH '" + WorkAppPath.AppPath + "\\Database'";
           dbCommand = new EDBCommand(SQL, EDBCCon);
           dbCommand.ExecuteNonQuery();
           EDBCCon.Close();

Since I use a static DB Connection...When I generate my Static Connection I make a call to this standalone method which is a one time per
execution each time the Application is started.
Tue, Jun 30 2009 2:20 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Pete,

<< Never mind...I resolved the problem
I was missing the  EDBCCon.ChangeDatabase("Configuration");  Connection
parameter  >>

Yes, you have to execute certain configuration-level SQL statements from the
context of the Configuration database because you are trying to alter the
object that you currently have open, i.e. the ListBuilder database.

Just be sure to change the current database back to the ListBuilder database
after you're done.

Also, just to clarify:

The database path is stored in the configuration file.  Think of it as a
simple map that tells EDB the names of the databases and where to find all
of them (plus some other information such as users and roles).

The database catalog does not contain any path information at all, and can
be moved around with the table files (always together, don't separate them)
without any issue, provided that you update the configuration file by using
the ALTER DATABASE statement to point to the new path where the database
catalog and table files are now located.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image