Subject | How to drop database in C# with .Net provider |
---|---|
Author | Myeongho |
Post date | 2011-09-22T05:22:04Z |
I want to use firebird on C# project. So I had test .net provider by below steps.
1. create database
2. open database
3. close database
4. drop database
I saw the error message while try to drop database.
What I have to do for delete the database.
following code & result message is mine.
----------------------------------------------------------
string connectionString =
"User=SYSDBA;" +
"Password=masterkey;" +
"Database=F:\\FirebirdDB\\testdb.fdb;" +
"DataSource=localhost;" +
"Charset=UTF8;" +
"ServerType=0";
try
{
// Create Database
FbConnection.CreateDatabase(connectionString);
// Create Connection object
FbConnection conFirebird = new FbConnection(connectionString);
// Connect
conFirebird.Open();
// Close
conFirebird.Close();
conFirebird.Dispose();
conFirebird = null;
// Drop Database
FbConnection.DropDatabase(connectionString);
}
catch (FbException ex)
{
txtResult.AppendText("Occured FbException => Error code : " + ex.ErrorCode.ToString() + "\n");
txtResult.AppendText("-------------------------------------------------------------\n");
txtResult.AppendText(ex.ToString() + "\n");
txtResult.AppendText("-------------------------------------------------------------\n");
}
Occured FbException => Error code : 335544510
-------------------------------------------------------------
FirebirdSql.Data.FirebirdClient.FbException (0x80004005): lock time-out on wait transaction
object F:\FIREBIRDDB\TESTDB.FDB is in use ---> lock time-out on wait transaction
object F:\FIREBIRDDB\TESTDB.FDB is in use
:
-------------------------------------------------------------
1. create database
2. open database
3. close database
4. drop database
I saw the error message while try to drop database.
What I have to do for delete the database.
following code & result message is mine.
----------------------------------------------------------
string connectionString =
"User=SYSDBA;" +
"Password=masterkey;" +
"Database=F:\\FirebirdDB\\testdb.fdb;" +
"DataSource=localhost;" +
"Charset=UTF8;" +
"ServerType=0";
try
{
// Create Database
FbConnection.CreateDatabase(connectionString);
// Create Connection object
FbConnection conFirebird = new FbConnection(connectionString);
// Connect
conFirebird.Open();
// Close
conFirebird.Close();
conFirebird.Dispose();
conFirebird = null;
// Drop Database
FbConnection.DropDatabase(connectionString);
}
catch (FbException ex)
{
txtResult.AppendText("Occured FbException => Error code : " + ex.ErrorCode.ToString() + "\n");
txtResult.AppendText("-------------------------------------------------------------\n");
txtResult.AppendText(ex.ToString() + "\n");
txtResult.AppendText("-------------------------------------------------------------\n");
}
Occured FbException => Error code : 335544510
-------------------------------------------------------------
FirebirdSql.Data.FirebirdClient.FbException (0x80004005): lock time-out on wait transaction
object F:\FIREBIRDDB\TESTDB.FDB is in use ---> lock time-out on wait transaction
object F:\FIREBIRDDB\TESTDB.FDB is in use
:
-------------------------------------------------------------