From: Martin <mc...@we...> - 2004-01-10 01:08:11
|
Hi, After I have done a select statement through the .net provider do I have to commit it? and if so what is the procedure. The reason I ask is that I have a drop down box in my web app which is populated with a datareader. The code populates the drop down box perfectly, however I noticed that straight after running this code I was unable to delete the actual .GDB file from windows explorer (NOTE. at present this is the only data access function in my entire app). The error message when I tried to delete the file was "sharing violation","..The source file may be in use" Now I don't actual want to delete the file, I am just using this method as a test to see if there has been any sharing violation caused with my code (which may cause other issues in the future). I have also noted the following behaviour. If I run my piece of code that populates my drop down box once and then go to the "firebird guardian" in control panel and attempt to stop the firebird service, I get the error message "Overlapped I/O operation in progress", although upon pressing OK the firebird service is stopped successfully, and I can now delete the file. so now I start over again with another copy of my .GDB file, I run the code to populate the drop down box again and it runs successfully, but after running it I can't delete the .GDB file because of the same error message that states there has been a sharing violation , despite the fact that my connection is now closed. The code I am running to populate my drop dowm box is Dim strSQL As String = "select ID, DISPLAY_TEXT from EE_SP_NAME ORDER BY DISPLAY_TEXT" Dim objConn As FirebirdSql.Data.Firebird.FbConnection = New FirebirdSql.Data.Firebird.FbConnection Dim objCMD As FirebirdSql.Data.Firebird.FbCommand = New FirebirdSql.Data.Firebird.FbCommand objConn.ConnectionString = ConfigurationSettings.AppSettings("DbConnectionString") objCMD.CommandText = strSQL objCMD.CommandType = CommandType.Text objConn.Open() objCMD.Connection = objConn CmbTargetGroup.DataSource = objCMD.ExecuteReader() CmbTargetGroup.DataValueField = "ID" CmbTargetGroup.DataTextField = "DISPLAY_TEXT" CmbTargetGroup.DataBind() objConn.Close() This code seems to close the connection ok (I've never had similar problems with it when using ms access or ms sql server) Now I realize that the above code does not have any transactions in it, so I figured this may be the problem (after all IB Expert always asks me if I want to commit SELECT statements..although I have no idea why..) so I put a transaction in the code as follows Dim strSQL As String = "select ID, DISPLAY_TEXT from EE_SP_NAME ORDER BY DISPLAY_TEXT" Dim objConn As FirebirdSql.Data.Firebird.FbConnection = New FirebirdSql.Data.Firebird.FbConnection Dim objCMD As FirebirdSql.Data.Firebird.FbCommand = New FirebirdSql.Data.Firebird.FbCommand Dim objTran As FirebirdSql.Data.Firebird.FbTransaction Dim objReader As FirebirdSql.Data.Firebird.FbDataReader objConn.ConnectionString = ConfigurationSettings.AppSettings("DbConnectionString") objCMD.CommandText = strSQL objCMD.CommandType = CommandType.Text objConn.Open() objTran = objConn.BeginTransaction() objCMD.Connection = objConn objCMD.Transaction = objTran objReader = objCMD.ExecuteReader() CmbTargetGroup.DataSource = objReader CmbTargetGroup.DataValueField = "ID" CmbTargetGroup.DataTextField = "DISPLAY_TEXT" CmbTargetGroup.DataBind() objReader.Close() objTran.Commit() objConn.Close() But still I get the shareing violation when I go to delete the file. I would be greatful if somebody could shed some light on this matter for me. I am assuming this sharing violation is being caused because I am not handling my data access correctly through the .net provider, but this has me a little stumped. many thanks in advance for any help. martin. |
From:
<car...@te...> - 2004-01-10 10:35:53
|
Hello: > After I have done a select statement through the .net provider do I > have to commit it? and if so what is the procedure. Which version of the .NET Data Provider are you using ?? Are you using connection pooling ?? (it's enabled by default) > The code I am running to populate my drop dowm box is Try this: Dim strSQL As String = "select ID, DISPLAY_TEXT from EE_SP_NAME ORDER BY DISPLAY_TEXT" Dim objConn As FirebirdSql.Data.Firebird.FbConnection = New FirebirdSql.Data.Firebird.FbConnection Dim objCMD As FirebirdSql.Data.Firebird.FbCommand = New FirebirdSql.Data.Firebird.FbCommand Dim objTran As FirebirdSql.Data.Firebird.FbTransaction Dim objReader As FirebirdSql.Data.Firebird.FbDataReader objConn.ConnectionString = ConfigurationSettings.AppSettings("DbConnectionString") objCMD.CommandText = strSQL objCMD.CommandType = CommandType.Text objConn.Open() objCMD.Connection = objConn objReader = objCMD.ExecuteReader() CmbTargetGroup.DataSource = objReader CmbTargetGroup.DataValueField = "ID" CmbTargetGroup.DataTextField = "DISPLAY_TEXT" CmbTargetGroup.DataBind() objReader.Close() objCMD.Dispose() objConn.Close() -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Martin <mc...@we...> - 2004-01-11 19:44:40
|
Hi Carlos, Thanks for the reply. I am using .NET Data Provider release candidate 2. I pasted in the code you provided but still I get error "sharing violation" when I go to delete the .gdb file after I have run my dot net code agaist it. here is the process I am following. 1. Locate the file (.gdb) that my web app (vb.net) will use and replace it with a fresh copy. 2. Run my web app agaist the fresh copy of the database once. 3. Again locate the file (.gdb) and attempt to delete it via windows explorer. This gives me "sharing violation" and since the only thing that accessed the database was my dot net code then I am assuming that this is causing some sort of locking. 4. Start the firebid control panel app and attempt to stop the service. At this point I get an error dialog saying "overlapped I/O" operation, although I am still able to stop the service and delete the file. Now I start the process of making small changes to my dot net code that accesses the database and restarting the whole process from stage 1 over again. I noticed that the code you provided added the call to dispose on the command object. This seemed to have no effect. cheers martin. "Carlos Guzmán Álvarez" <car...@te...> wrote in message news:3FF...@te...... > Hello: > > > After I have done a select statement through the .net provider do I > > have to commit it? and if so what is the procedure. > > Which version of the .NET Data Provider are you using ?? Are you using > connection pooling ?? (it's enabled by default) > > > The code I am running to populate my drop dowm box is > > Try this: > > Dim strSQL As String = "select ID, DISPLAY_TEXT from EE_SP_NAME > ORDER BY DISPLAY_TEXT" > Dim objConn As FirebirdSql.Data.Firebird.FbConnection = New > FirebirdSql.Data.Firebird.FbConnection > Dim objCMD As FirebirdSql.Data.Firebird.FbCommand = New > FirebirdSql.Data.Firebird.FbCommand > Dim objTran As FirebirdSql.Data.Firebird.FbTransaction > Dim objReader As FirebirdSql.Data.Firebird.FbDataReader > objConn.ConnectionString = > ConfigurationSettings.AppSettings("DbConnectionString") > objCMD.CommandText = strSQL > objCMD.CommandType = CommandType.Text > objConn.Open() > objCMD.Connection = objConn > objReader = objCMD.ExecuteReader() > CmbTargetGroup.DataSource = objReader > CmbTargetGroup.DataValueField = "ID" > CmbTargetGroup.DataTextField = "DISPLAY_TEXT" > CmbTargetGroup.DataBind() > objReader.Close() > objCMD.Dispose() > objConn.Close() > > > > > -- > Best regards > > Carlos Guzmán Álvarez > Vigo-Spain > > > ------------------------------------------------------- > This SF.net email is sponsored by: Perforce Software. > Perforce is the Fast Software Configuration Management System offering > advanced branching capabilities and atomic changes on 50+ platforms. > Free Eval! http://www.perforce.com/perforce/loadprog.html > _______________________________________________ > Firebird-net-provider mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > |
From:
<car...@te...> - 2004-01-11 21:24:21
|
Hello: > I noticed that the code you provided added the call to dispose on the > command object. This seemed to have no effect. Ok, thanks, one question, are you using connection pooling ?? it's enabled by default and with it enabled connections are not really closed when you call FbConnection.Close method, they return to the pool and will be closed when they are expired. -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Martin <mc...@we...> - 2004-01-11 21:33:00
|
Hi, I have not knowingly turned on/off connection pooling so I guess I am using the default of ON. Is connection pooling just turned on in the connection string or is there a .net setting to do this. The connection string that I am using is this (from my web config file) <add key="DbConnectionString" value="Database=C:\\Inetpub\\wwwroot\\NZ\\_database\\RESTOREDB.GDB;User=SYSD BA;Password=masterkey;Dialect=3;Server=localhost"/> would I have to add some sort of attribute to this to disable connection pooling?? could you help me out here please?? cheers martin. "Carlos Guzmán Álvarez" <car...@te...> wrote in message news:400...@te...... > Hello: > > > I noticed that the code you provided added the call to dispose on the > > command object. This seemed to have no effect. > > Ok, thanks, one question, are you using connection pooling ?? it's > enabled by default and with it enabled connections are not really closed > when you call FbConnection.Close method, they return to the pool and > will be closed when they are expired. > > > > > -- > Best regards > > Carlos Guzmán Álvarez > Vigo-Spain > > > ------------------------------------------------------- > This SF.net email is sponsored by: Perforce Software. > Perforce is the Fast Software Configuration Management System offering > advanced branching capabilities and atomic changes on 50+ platforms. > Free Eval! http://www.perforce.com/perforce/loadprog.html > _______________________________________________ > Firebird-net-provider mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > |
From:
<car...@te...> - 2004-01-11 21:54:46
|
Hello: > Is connection pooling just turned on in the connection string or is there a > .net setting to do this. This is done using the connection string: Pooling=false Try this and comment the results please :): <add key="DbConnectionString" value="Database=C:\\Inetpub\\wwwroot\\NZ\\_database\\RESTOREDB.GDB;User=SYSDBA; Password=masterkey;Dialect=3;Server=localhost;Pooling=false"/> -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Martin <mc...@we...> - 2004-01-11 22:20:03
|
Hi Carlos, This has worked brilliantly, I am now able to delete the file after running my dot net code. Thank you. This particular problem has brought up the issue of the benefits of using connection pooling on a firebird db. If say I had a busy website using a firebird db as a back end, that was using connection pooling and was visited by a fair amont of people. Then supposing I needed to take the website down for a short period of time, say for routine maintenance, I would have a whole pile of open connections in my database. I guess that I would need to close the connections gracefully, I'm not sure how I would do this. This situation could arise if say a problem arose on my production site and I wanted to shut my production site down for a while and copy the production database to my development server, Firstly stoping the firebird service on the production server. Stopping the service would report "Overlapping I/O operation." anyway, I know the above is not a .net question and probably hightlights my limited understanding of firebird, it's just got me wondering, that all. Thanks agian for helping me out. cheers martin. "Carlos Guzmán Álvarez" <car...@te...> wrote in message news:400...@te...... > Hello: > > > Is connection pooling just turned on in the connection string or is there a > > .net setting to do this. > > This is done using the connection string: > > Pooling=false > > Try this and comment the results please :): > > <add key="DbConnectionString" > value="Database=C:\\Inetpub\\wwwroot\\NZ\\_database\\RESTOREDB.GDB;User=SYSD BA; > Password=masterkey;Dialect=3;Server=localhost;Pooling=false"/> > > > > -- > Best regards > > Carlos Guzmán Álvarez > Vigo-Spain > > > ------------------------------------------------------- > This SF.net email is sponsored by: Perforce Software. > Perforce is the Fast Software Configuration Management System offering > advanced branching capabilities and atomic changes on 50+ platforms. > Free Eval! http://www.perforce.com/perforce/loadprog.html > _______________________________________________ > Firebird-net-provider mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > |
From:
<car...@te...> - 2004-01-11 23:15:07
|
Hello: > This has worked brilliantly, I am now able to delete the file after running > my dot net code. Thank you. :) > This particular problem has brought up the issue of the benefits of using > connection pooling on a firebird db. > If say I had a busy website using a firebird db as a back end, that was > using connection pooling and was visited by a fair amont of people. Huuummmm a thing you can test is to try to use the Connection Lifetime parameter in the connection string, for see if it can help. > Then supposing I needed to take the website down for a short period of time, > say for routine maintenance, I would have a whole pile of open connections > in my database. > I guess that I would need to close the connections gracefully, I'm not sure > how I would do this. Huummm you can try to create a static method in FbConnection, called for example CleanPool, for clean all the connections in the pool, if there are more people interested on this i can make it in the provider sources :), i can try to review too if there are anything arround this in the .NET Framework 1.1 and 1.2 documentation. > This situation could arise if say a problem arose on my production site and > I wanted to shut my production site down for a while and copy the production > database to my development server, Firstly stoping the firebird service on > the production server. Stopping the service would report "Overlapping I/O > operation." Huummm if you want to do backups you can do that without make a shutdown of the server, but i don't know if you mean this type of maintenance tasks :) -- Best regards Carlos Guzmán Álvarez Vigo-Spain |
From: Martin <mc...@we...> - 2004-01-11 23:35:19
|
Hi, I have found that if I run at least 1 call to the database without the "pooling=false" addition to the connection string then locking of the .gdb file will occur and I will not be able to delete the file after running my dot net code. however as soon as I chage the connection string in web.config to include the "pooling=false" in the connection string and run a query, agaist the previously locked file, then the connection pool seems to be cleared. I not sure if this is because the dot.net project has been recompiled becasue of the change to web.config or not. anyway, my problem is solved, but if you do any "cleanPool" functionality to "fbConnection" then I for one would be interested in using it. cheers martin. "Carlos Guzmán Álvarez" <car...@te...> wrote in message news:400...@te...... > Hello: > > > This has worked brilliantly, I am now able to delete the file after running > > my dot net code. Thank you. > > :) > > > This particular problem has brought up the issue of the benefits of using > > connection pooling on a firebird db. > > If say I had a busy website using a firebird db as a back end, that was > > using connection pooling and was visited by a fair amont of people. > > Huuummmm a thing you can test is to try to use the Connection Lifetime > parameter in the connection string, for see if it can help. > > > Then supposing I needed to take the website down for a short period of time, > > say for routine maintenance, I would have a whole pile of open connections > > in my database. > > I guess that I would need to close the connections gracefully, I'm not sure > > how I would do this. > > Huummm you can try to create a static method in FbConnection, called for > example CleanPool, for clean all the connections in the pool, if there > are more people interested on this i can make it in the provider sources > :), i can try to review too if there are anything arround this in the > .NET Framework 1.1 and 1.2 documentation. > > > This situation could arise if say a problem arose on my production site and > > I wanted to shut my production site down for a while and copy the production > > database to my development server, Firstly stoping the firebird service on > > the production server. Stopping the service would report "Overlapping I/O > > operation." > > Huummm if you want to do backups you can do that without make a shutdown > of the server, but i don't know if you mean this type of maintenance > tasks :) > > > > > > -- > Best regards > > Carlos Guzmán Álvarez > Vigo-Spain > > > ------------------------------------------------------- > This SF.net email is sponsored by: Perforce Software. > Perforce is the Fast Software Configuration Management System offering > advanced branching capabilities and atomic changes on 50+ platforms. > Free Eval! http://www.perforce.com/perforce/loadprog.html > _______________________________________________ > Firebird-net-provider mailing list > Fir...@li... > https://lists.sourceforge.net/lists/listinfo/firebird-net-provider > |