Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread ElevateDB C#.NET Configuration
Mon, Jan 21 2008 11:12 AMPermanent Link

Matej Kozinc
I have made the application that uses ElevateDB database. Everything works fine.
I would like to make installation of this application and since users can change the
location of application, the configuration file of database should be updated to show that
database is now located on a different location. I cannot find a way to change the
configuration file (or make a new one if that is necessary) so that it would point to a
new destination on user's computer.

I am using VS2005.NET / C#, .NET ElevateDB Provider (dll) v.1.7.1.0

I have seen the TEDBEngine (or EDBEngine?) class on the following page:
http://www.elevatesoft.com/scripts/newsgrp.dll?action=searchopenmsg&group=16&msg=3049&keywords=configuration*#msg3049
but I could not find this class in elevate.elevatedb.data dll.

Thanks in advance, MK
Mon, Jan 21 2008 12:41 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matej,

<< I have made the application that uses ElevateDB database. Everything
works fine. I would like to make installation of this application and since
users can change the location of application, the configuration file of
database should be updated to show that database is now located on a
different location. I cannot find a way to change the configuration file (or
make a new one if that is necessary) so that it would point to a new
destination on user's computer. >>

You can change the configuration file location by setting the ConfigPath
connection string attribute:

http://www.elevatesoft.com/scripts/manual.dll?action=mantopic&id=edb1dac&category=3&topic=4
http://www.elevatesoft.com/scripts/manual.dll?action=mantopic&id=edb1dac&category=2&topic=3

Also, to change the database path for an existing database in the
configuration file, you can just use the ALTER DATABASE DDL statement:

http://www.elevatesoft.com/scripts/manual.dll?action=mantopic&id=edb1sql&category=10&topic=93

and pass in the new PATH value in that statement.

Are you going to ship the configuration file and database files (catalog and
table files) with your application ?

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jan 22 2008 4:50 AMPermanent Link

Matej Kozinc
Tim,

<<Also, to change the database path for an existing database in the
configuration file, you can just use the ALTER DATABASE DDL statement:

http://www.elevatesoft.com/scripts/manual.dll?action=mantopic&id=edb1sql&category=10&topic=93

and pass in the new PATH value in that statement.>>

I have tried the ALTER DATABASE but received an error:

 ElevateDB Error #300 Cannot lock database PK for exclusive access

No other application was accessing the configuration or database files.

<<Are you going to ship the configuration file and database files (catalog and
table files) with your application ?>>

Yes, both configuration and database files will be included with application.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Jan 22 2008 12:21 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matej,

<< I have tried the ALTER DATABASE but received an error:

 ElevateDB Error #300 Cannot lock database PK for exclusive access

No other application was accessing the configuration or database files. >>

What is the code that you're using to execute the ALTER DATABASE statement ?
You have to make sure that the current database is the system-defined
Configuration database when you execute database-level DDL statements.  You
can use the EDBConnection.ChangeDatabase() method to change to the
Configuration database.  Just pass the value "Configuration" as the
parameter to that method.   When you're done, you can then change back to
the normal database.

--
Tim Young
Elevate Software
www.elevatesoft.com

Wed, Jan 23 2008 7:58 AMPermanent Link

Matej Kozinc
The code I am using:
EDBConnection conn = makeConnString();

string sql = "ALTER DATABASE \"PK\" PATH 'C:\\PKDB'";
EDBCommand com = new EDBCommand(sql, conn);

conn.Open();
com.ExecuteNonQuery();
conn.Close();
conn.Dispose();

I've added the "conn.ChangeDatabase("Configuration");" after the "conn.Open();" statement
and now it works perfectly.

Thank you very much Tim.
Wed, Jan 23 2008 3:09 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matej,

<< I've added the "conn.ChangeDatabase("Configuration");" after the
"conn.Open();" statement and now it works perfectly. >>

Cool.  Please let me know if you have any other issues.

--
Tim Young
Elevate Software
www.elevatesoft.com

Fri, Feb 15 2008 7:47 AMPermanent Link

Matej Kozinc
Tim,

I thought that I fixed this problem that I had with changing the path, but it seems that I
didn't. Changing the path of database works if the original database is already on the
system. With clients computers that is obviously not so. I install the application with
database on a clients computer to Program files directory. When I run the application I
catch this exception:
System.ArgumentException: The path is not of a legal form.
  at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
  at System.IO.Path.GetFullPathInternal(String path)
  at System.IO.DirectoryInfo..ctor(String path)
  at edbosfilemgr.Units.edbosfilemgr.CreateDirectory(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edbosfilemgr.TEDBOSFileManager.CreatePath(String Value)
  at edblocal.TEDBLocalDatabaseManager.Open(TEDBLockType DatabaseLockType)
  at edblocal.TEDBLocalSessionManager.OpenDatabase(String DatabaseName, TEDBLockType
DatabaseLockType)
  at edbconnmgr.TEDBConnectionManager.OpenDatabase()
  at Elevate.ElevateDB.Data.EDBConnection.Open()
  at SoftPK.PostnaKnjiga.pointToDatabase(String path)
This exception does not occour if the original database on its original location is
present. I would really use some help with this.

Thanks, Matej Kozinc
Fri, Feb 15 2008 2:53 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Matej,

<< I thought that I fixed this problem that I had with changing the path,
but it seems that I didn't. Changing the path of database works if the
original database is already on the system. With clients computers that is
obviously not so. I install the application with database on a clients
computer to Program files directory. When I run the application I catch this
exception: >>

Are you actually storing the database in the Program Files directory tree ?
Are you using Vista at all ?  If not, then I will test it here with XP SP2
and see if perhaps there is an issue with the directory creation.

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, Feb 17 2008 5:36 AMPermanent Link

Matej Kozinc
Tim,

Yes, the database is stored in program files directory. User has all rights on that
computer. We are using XP SP2.

The code for changing db:

EDBConnection conn = makeConnString();
path =
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\",
"") + path;
string sql = "ALTER DATABASE \"PK\" PATH '" + path.Replace("'", "''") + "'";
EDBCommand com = new EDBCommand(sql, conn);

conn.Open();
           
conn.ChangeDatabase("Configuration");
com.ExecuteNonQuery();
conn.Close();
conn.Dispose();
-------------------

I am sending you setup of application. It will deploy database in that directory as well
(the SoftDB folder).

Thanks.
Sun, Feb 17 2008 10:47 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Matej


Before anyone else slaps your wrist - please do not post large attachments directly in the newsgroup - use the binaries. If its only for Tim then email it to him directly.

Remember a lot of people are still on dial up.

Roy Lambert

ps this especially applies to .exes
Page 1 of 2Next Page »
Jump to Page:  1 2
Image