Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 5 of 5 total |
Change Database Location? |
Sun, Jul 10 2011 8:19 AM | Permanent Link |
newuser | Hi
after crating a database in a location (ex. Desktop) I moved it to another location (ex. c:\) so now how do I config that again, because everty time it`s looking for first created place and with executing "change database ... " command, I got error saying "can not lock database for exclusive access" |
Sun, Jul 10 2011 9:57 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Have you changed the engine/session configuration path first? If so you need to execute the command "ALTER DATABASE xxx PATH yyy" before you try and open the database.
Roy Lambert [Team Elevate] |
Sun, Jul 10 2011 12:44 PM | Permanent Link |
newuser | Thank for you reply
I`m executing alter database ... with new PATH value, would you please write a sample code of changing engine/session configuration path (or whole code of changing database location) |
Mon, Jul 11 2011 3:26 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Go into EDBManager and change it in there. Then look at the SQL History and that will tell you the SQL used to make the changes.
Roy Lambert [Team Elevate] |
Fri, Jul 15 2011 1:37 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << after crating a database in a location (ex. Desktop) I moved it to
another location (ex. c:\) so now how do I config that again, because everty time it`s looking for first created place and with executing "change database ... " command, I got error saying "can not lock database for exclusive access" >> With a .NET EDBConnection and EDBCommand objects, you must do the following: 1) Use the EDBConnection.ChangeDatabase() method to switch from your "normal" database to the special "Configuration" database: MyConnection.ChangeDatabase("Configuration"); 2) Execute the appropriate ALTER DATABASE statement to change the path using an EDBCommand: http://www.elevatesoft.com/manual?action=viewtopic&id=edb2sql&topic=ALTER_DATABASE MyCommand.Text = "ALTER DATABASE..."; MyCommand.Execute(); 3) Use the EDBConnection.ChangeDatabase() method to switch back to the database that you just altered. Here's an example (C#, but the code is the same in VB.NET): using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Elevate.ElevateDB.Data; namespace AlterEDBDatabasePath { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { EDBConnection DataConnection = new EDBConnection(@"NAME=Test;DESCRIPTION=Test Connection;TYPE=LOCAL;CONFIGPATH=C:\Unicode;DATABASE=ADOUnicodeTest;UID=Administrator;PWD=EDBDefault"); DataConnection.Open(); DataConnection.ChangeDatabase("Configuration"); EDBCommand DataCommand = new EDBCommand(); DataCommand.Connection = DataConnection; // Alter the database path DataCommand.CommandText = @"ALTER DATABASE ADOUnicodeTest PATH 'c:\newpath\data'"; DataCommand.ExecuteNonQuery(); DataConnection.ChangeDatabase("ADOUnicodeTest"); DataConnection.Close(); } } } -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, June 12, 2024 at 01:54 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |