some question about how to release database file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

some question about how to release database file

冰风
hi,guys

I have a question about how to release database file.

When i use the Firebird ADO.NET Data Provider and i use the firebird database as embedded server,my program can't release the database file though i have used function conn.Close() and conn.Dispose().
I can see that the database file is also linked by my demo  in windows resource monitor,and i can't connect this database by other program such as Firebird Maestro.
Now, the only way to release the database file is to close my program.

How can i do to release the database file but not close my program?

This is my program code (C#):

FbConnectionStringBuilder connBuilder = new FbConnectionStringBuilder();
connBuilder.UserID = "sysdba";
connBuilder.ServerType = FbServerType.Embedded;
connBuilder.Database = @"E:\db.fdb";
string strsql = "SELECT COUNT(RDB$RELATION_NAME) FROM RDB$RELATIONS WHERE (RDB$RELATION_NAME = 'TABLE_TMP') AND RDB$VIEW_SOURCE IS NULL;";
bool flag=false;
using (FbConnection conn = new FbConnection(connBuilder.ConnectionString))
{
conn.Open();
FbCommand cmd = new FbCommand(strsql, conn);
FbDataReader dr = cmd.ExecuteReader();
dr.Read();
if ((int)dr[0] > 0)
{
   flag = true;
}
conn.Close();
}

please tell me how to do that . thanks so much!

Best Regards,
Aeolus Yang

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Firebird-net-provider mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
Reply | Threaded
Open this post in threaded view
|

Re: some question about how to release database file

Jiří Činčura-2
Empty the pool for that connection or do not use the pooling.

--
Mgr. Jiří Činčura
Independent IT Specialist


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Firebird-net-provider mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider