FbConnection.CreateDatabase does not always throw exceptions when it cannot 
create the database
-----------------------------------------------------------------------------------------------

                 Key: DNET-398
                 URL: http://tracker.firebirdsql.org/browse/DNET-398
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 2.6.5
            Reporter: Fernando Nájera
            Assignee: Jiri Cincura
            Priority: Critical


Consider the following code:

string file = @"X:\Test.fdb";
File.Delete (file);

string cnnStr = @"character set=UTF8;connection lifetime=15;user 
id=SYSDBA;password=masterkey;initial catalog=" + file + @";data 
source=localhost;dialect=3;pooling=False;min pool size=0;max pool 
size=50;packet size=8192;server type=Default";
FbConnection.CreateDatabase (cnnStr, 8192, true, false);
FbConnection.CreateDatabase (cnnStr, 8192, true, false);


Test #1: run the code as-is

In 2.6.0.0, the second CreateDatabase fails with 'I/O error during "CreateFile 
(create)" operation for file "X:\TEST.FDB" // Error while trying to create 
file', which is fine.
In 2.6.5.0, the second CreateDatabase fails with 'I/O error during "CreateFile 
(create)" operation for file "X:\TEST.FDB" // Error while trying to create 
file', which is fine.

Test #2: run up to the first FbConnection, then connect to the database using 
another process (e.g. via isql), and while connected, run the second 
FbConnection

In 2.6.0.0, the second CreateDatabase fails with 'invalid database handle (no 
active connection)', which is good enough for me.
In 2.6.5.0, the second CreateDatabase does not throw any exception!

Test #3: change the code above so instead of the two CreateDatabase calls you 
have now this:

FbConnection.CreateDatabase (cnnStr, 8192, true, false);
using (FbConnection cnn = new FbConnection (cnnStr))
{
    cnn.Open ();
    FbConnection.CreateDatabase (cnnStr, 8192, true, false);
}

In 2.6.0.0, the second CreateDatabase fails with 'invalid database handle (no 
active connection)', which is good enough for me.
In 2.6.5.0, the second CreateDatabase does not throw any exception!

The bottom line is, if the database has any active connection (by the same or 
by another process), CreateDatabase does not fail in 2.6.5.0! This is a change 
of behaviour against 2.6.0.0, and in my opinion is a bug - CreateDatabase 
should create a database, or fail.

I have put the priority to Critical, because this behavior can effectively lead 
to crashes - the call does not fail, so you think you have created a new, empty 
database, when in fact you are reusing an existing database!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to