I've fixed this issue by placing the firebird client dlls in
C:\Windows\Microsoft.NET\Framework\v2.0.50727 so that Visual Studio can
see them.
John

-----Original Message-----
From: firebird-net-provider-requ...@lists.sourceforge.net
[mailto:firebird-net-provider-requ...@lists.sourceforge.net] 
Sent: Monday, February 08, 2010 8:22 AM
To: firebird-net-provider@lists.sourceforge.net
Subject: Firebird-net-provider Digest, Vol 46, Issue 5

Send Firebird-net-provider mailing list submissions to
        firebird-net-provider@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
        
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider
or, via email, send a message with subject or body 'help' to
        firebird-net-provider-requ...@lists.sourceforge.net

You can reach the person managing the list at
        firebird-net-provider-ow...@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Firebird-net-provider digest..."


Today's Topics:

   1. [FB-Tracker] Created: (DNET-293) Do not use
      Process.GetCurrentProcess() to get calling executable (Valeriy
(JIRA))
   2. How do I generate an EDMX file with       Firebird Embedded?
(Rick)
   3. [FB-Tracker] Created: (DNET-294) An exception was thrown by
      the type initializer for FirebirdSql.Data.Common.Charset
      (Daniel Junges (JIRA))
   4. Re: How do I generate an EDMX file with   Firebird Embedded?
      (Jiri Cincura)
   5. [FB-Tracker] Created: (DNET-295) Correction for Firebird
      ForeignKeyCoumns schema (Jiri Cincura (JIRA))
   6. FW: connection pooling in a multithreading        environment
      (Bruce Tiffany)


----------------------------------------------------------------------

Message: 1
Date: Fri, 5 Feb 2010 21:55:31 +0000 (GMT+00:00)
From: "Valeriy (JIRA)" <trac...@firebirdsql.org>
Subject: [Firebird-net-provider] [FB-Tracker] Created: (DNET-293) Do
        not use Process.GetCurrentProcess() to get calling executable
To: firebird-net-provider@lists.sourceforge.net
Message-ID:
        
<795547696.11001265406932990.javamail.tom...@tracker.firebirdsql.org>
Content-Type: text/plain; charset=UTF-8

Do not use Process.GetCurrentProcess() to get calling executable
----------------------------------------------------------------

                 Key: DNET-293
                 URL: http://tracker.firebirdsql.org/browse/DNET-293
             Project: .NET Data provider
          Issue Type: Improvement
    Affects Versions: 2.5.1
         Environment: Windows XP SP3, Kaspersky Internet Security 2009
            Reporter: Valeriy
            Assignee: Jiri Cincura
            Priority: Blocker


In FbConnectionInternal.cs at line 548 DO NOT use
"Process.GetCurrentProcess().MainModule.FileName" to determine calling
executable. Instead of this please use
"Assembly.GetEntryAssembly().Location" because call to
Process.GetCurrentProcess() demands application to increase they
privileges to "Debug privileges" (that we don't need at all).

By calling "Assembly.GetEntryAssembly().Location"  we will get the same
process string as call to
"Process.GetCurrentProcess().MainModule.FileName" but without requesting
debug privileges.

-- 
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

        



------------------------------

Message: 2
Date: Sat, 6 Feb 2010 22:31:29 -0800
From: "Rick" <rick__...@hotmail.com>
Subject: [Firebird-net-provider] How do I generate an EDMX file with
        Firebird Embedded?
To: <firebird-net-provider@lists.sourceforge.net>
Message-ID: <bay117-ds4769428e4faf58b101b93a8...@phx.gbl>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

Win7 Pro 64bit

How do I generate an EDMX file (for the Entity Framework - inside of
VS2008) geared toward an app that uses the Firebird Embedded version?

Going through the steps of adding a new ADO.net Entity Model (within
VS2008) I don't see a Firebird provider for a connection when I get to
that point of connecting to the Embedded database (VS default GUI for
listing available providers for databases when trying to connect to a
database). I have tried adding the Firebird.Net Provider v2.5.1 version
of the FirebirdSql.Data.FirebirdClient.dll into the GAC etc. but that
doesn't have any effect. 

I have tried installing the DDEX Provider 2.0.4, but that really didn't
take (the GUI comes up transparent on the form like its not enabled).

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 3
Date: Sun, 7 Feb 2010 12:14:25 +0000 (GMT+00:00)
From: "Daniel Junges (JIRA)" <trac...@firebirdsql.org>
Subject: [Firebird-net-provider] [FB-Tracker] Created: (DNET-294) An
        exception was thrown by the type initializer for
        FirebirdSql.Data.Common.Charset
To: firebird-net-provider@lists.sourceforge.net
Message-ID:
        
<794053170.11191265544865107.javamail.tom...@tracker.firebirdsql.org>
Content-Type: text/plain; charset=UTF-8

An exception was thrown by the type initializer for
FirebirdSql.Data.Common.Charset
------------------------------------------------------------------------
-----------

                 Key: DNET-294
                 URL: http://tracker.firebirdsql.org/browse/DNET-294
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
         Environment: Suse Linux, Mono 2.6.1, ASP.NET
            Reporter: Daniel Junges
            Assignee: Jiri Cincura
            Priority: Blocker


We are developing an solution in asp.net and using the Firebird .NET
Provider.
I have searched a lot on google, have downloaded the lstes version from
svn and added the solution:

http://firebird.svn.sourceforge.net/viewvc/firebird/NETProvider/tags/NET
Provider_2.5.1/source/FirebirdSql/Data/
with the symbols: TRACE;MONO;LINUX

and i still get the follow exeption
An exception was thrown by the type initializer for
FirebirdSql.Data.Common.Charset
  at ...OpenMyDBConnection () [0x00000] in <filename unknown>:0 


-- 
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

        



------------------------------

Message: 4
Date: Sun, 7 Feb 2010 13:33:07 +0100
From: Jiri Cincura <disk...@cincura.net>
Subject: Re: [Firebird-net-provider] How do I generate an EDMX file
        with    Firebird Embedded?
To: "For users and developers of the Firebird .NET providers"
        <firebird-net-provider@lists.sourceforge.net>
Message-ID:
        <d2fa8bfb1002070433i346ebedcr4d4efb17c7b89...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Feb 7, 2010 at 07:31, Rick <rick__...@hotmail.com> wrote:
> How do I generate an EDMX file (for the Entity Framework - inside of
VS2008)
> geared toward an app that uses the Firebird Embedded version?

Same way as for "big" server.

> I have tried installing the DDEX Provider 2.0.4, but that really
didn't take
> (the GUI comes up transparent on the form like its not enabled).

You need to add DDEX. If didn't see FB provider in list, read the readme
again.

-- 
Jiri {x2} Cincura (CTO x2develop.com)
http://blog.cincura.net/ | http://www.ID3renamer.com



------------------------------

Message: 5
Date: Mon, 8 Feb 2010 13:12:24 +0000 (GMT+00:00)
From: "Jiri Cincura (JIRA)" <trac...@firebirdsql.org>
Subject: [Firebird-net-provider] [FB-Tracker] Created: (DNET-295)
        Correction for Firebird ForeignKeyCoumns schema
To: firebird-net-provider@lists.sourceforge.net
Message-ID:
        
<1898401261.11391265634744472.javamail.tom...@tracker.firebirdsql.org>
Content-Type: text/plain; charset=UTF-8

Correction for Firebird ForeignKeyCoumns schema
-----------------------------------------------

                 Key: DNET-295
                 URL: http://tracker.firebirdsql.org/browse/DNET-295
             Project: .NET Data provider
          Issue Type: Bug
          Components: ADO.NET Provider
    Affects Versions: 2.5.1
            Reporter: Jiri Cincura
            Assignee: Jiri Cincura
            Priority: Minor
         Attachments: DatabaseCreation.sql

Reported to me, privately by Van Den Berghe, Vincent.
===
I have been thinking about a way to illustrate the bug, such that the
method might be included in a future test.
After some thinking, I came up with the function below:

        public void CheckForeignKey(FbConnection connection)
        {
            foreach (DataRow row in
connection.GetSchema("ForeignKeys").Rows)
            {
                var constraintName = (string)row["CONSTRAINT_NAME"];
                var tableName = (string)row["TABLE_NAME"];
                var referencedTableName =
(string)row["REFERENCED_TABLE_NAME"];
#if true
                // this fails:
                foreach (DataRow pr in
connection.GetSchema("ForeignKeyColumns", new string[] { null, null,
tableName, constraintName }).Rows)
                {
                    Debug.Assert(constraintName ==
(string)pr["CONSTRAINT_NAME"]);
                    Debug.Assert(tableName == (string)pr["TABLE_NAME"]);
                    Debug.Assert(referencedTableName ==
(string)pr["REFERENCED_TABLE_NAME"]);
                }
#else
                // use this instead of
connection.GetSchema("ForeignKeyColumns") until the bug has been
corrected 
                string commandText = @" 
SELECT null AS CONSTRAINT_CATALOG,null AS
CONSTRAINT_SCHEMA,co.rdb$constraint_name AS CONSTRAINT_NAME, 
null AS TABLE_CATALOG,null AS TABLE_SCHEMA,co.rdb$relation_name AS
TABLE_NAME,
coidxseg.rdb$field_name AS COLUMN_NAME, 
null as REFERENCED_TABLE_CATALOG,null as
REFERENCED_TABLE_SCHEMA,refco.rdb$relation_name AS
REFERENCED_TABLE_NAME,
refidxseg.rdb$field_name AS REFERENCED_COLUMN_NAME,
coidxseg.rdb$field_position AS ORDINAL_POSITION
FROM rdb$ref_constraints ref 
INNER JOIN rdb$relation_constraints co ON
ref.rdb$constraint_name=co.rdb$constraint_name 
INNER JOIN rdb$index_segments coidxseg ON
co.rdb$index_name=coidxseg.rdb$index_name 
INNER JOIN rdb$relation_constraints refco ON
ref.rdb$const_name_uq=refco.rdb$constraint_name 
INNER JOIN rdb$index_segments refidxseg ON
refco.rdb$index_name=refidxseg.rdb$index_name AND
coidxseg.rdb$field_position=refidxseg.rdb$field_position
WHERE co.rdb$relation_na...@p0 AND co.rdb$constraint_na...@p1
ORDER BY ref.rdb$constraint_name,coidxseg.rdb$field_position"
                ;
                // AND coidxseg.rdb$field_name = @p3", 
                using (var cmd = connection.CreateCommand())
                {
                    cmd.CommandText = commandText;
                    cmd.Parameters.Add(
                    "@p0", FbDbType.Char, 31).Value = tableName;
                    cmd.Parameters.Add(
                    "@p1", FbDbType.Char, 31).Value = constraintName;
                    //cmd.Parameters.Add("@p3", FbDbType.Char, 31).Value
= fieldName; 
                    using (var reader = cmd.ExecuteReader())
                        while (reader.Read())
                        {
                            Debug.Assert(constraintName ==
reader.GetString(2 /*"CONSTRAINT_NAME"*/).TrimEnd());
                            Debug.Assert(tableName == reader.GetString(5
/*"TABLE_NAME"*/).TrimEnd());
                            Debug.Assert(referencedTableName ==
reader.GetString(9/*"REFERENCED_TABLE_NAME"*/).TrimEnd());
                        }
                }
#endif
            }
        }


This function will  just loop through all foreign key definition, get
the columns and perform some simple checks on the latter (the constraint
name, table name and referenced table name must all match).
Executed as such, the function will fail, because of the bug in
ForeignKeyColumns.
If you change the #if true to #if false, and use the corrected (and
compatible) query, the function will succeed.
You can try it on the database model included in this e-mail
(DatabaseCreation.sql).


-- 
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

        



------------------------------

Message: 6
Date: Mon, 8 Feb 2010 08:21:41 -0500
From: "Bruce Tiffany" <btiff...@pbs.org>
Subject: [Firebird-net-provider] FW: connection pooling in a
        multithreading  environment
To: <firebird-net-provider@lists.sourceforge.net>
Message-ID:
        <fd240fabfa66b14aab4b2bcf4a004e9f03548...@excl.hq.corp.pbs.org>
Content-Type: text/plain;       charset="us-ascii"

Apparently this never appeared the first time.

-----Original Message-----
From: Bruce Tiffany 
Sent: Thursday, February 04, 2010 9:18 PM
To: 'firebird-net-provider@lists.sourceforge.net'
Subject: connection pooling in a multithreading environment

We encountered an error in FB 2.1.0 and 2.5.1 in some web applications:
================================================
Message: Object reference not set to an instance of an object. 
Source: FirebirdSql.Data.FirebirdClient 
Stack trace: at
FirebirdSql.Data.FirebirdClient.FbCommand.RollbackImplicitTransaction()
at FirebirdSql.Data.FirebirdClient.FbCommand.CommitImplicitTransaction()
at
FirebirdSql.Data.FirebirdClient.FbCommand.DiscardImplicitTransaction()
at
FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior
behavior) at
FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteDbDataReader(CommandBeh
avior behavior) at
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(Comman
dBehavior behavior) at
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior) at
System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32
startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior
behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at <et-cetera>
==================================================
Similar errors were occurring too frequently from various Firebird
queries (all SELECT; no updates, deletions or insertions), some very
simple, some very complex.  We tried adding explicit transactions and
committing in lieu of implicit transaction control, to no avail.

We determined that the exception originated in the following Firebird
code:

public FbDataReader ExecuteReader(CommandBehavior behavior) 
{ 
    lock (this) 
    { 
        this.CheckCommand(); 
        try 
        { 
            this.ExecuteCommand(behavior, true); 
        } 
        catch (IscException exception) 
        { 
            this.DiscardImplicitTransaction(); 
            throw new FbException(exception.Message, exception); 
        } 
        catch 
        { 
            this.DiscardImplicitTransaction(); 
            throw; 
        } 
    } 
    this.activeReader = new FbDataReader(this, this.connection,
behavior); 
    return this.activeReader; 
} 

Specifically, the line "this.ExecuteCommand(behavior,true);".  Because
this line is enclosed within a try/catch block, the exception is
handled.  However, this alters program flow to the catch block.  Inside
the catch block, the DiscardImplicitTransaction() method is called
before the Exception is thrown.  Unfortunately, that method calls
CommitImplicitTransaction: 

internal void CommitImplicitTransaction() 
{ 
    if ((this.HasImplicitTransaction && (this.transaction != null)) &&
(this.transaction.Transaction != null)) 
    { 
        try 
        { 
            this.transaction.Commit(); 
        } 
        catch (Exception) 
        { 
            this.RollbackImplicitTransaction(); 
            throw; 
        } 
        finally 
        { 
            if (this.transaction != null) 
            { 
                this.transaction.Dispose(); 
                this.transaction = null; 
                this.implicitTransaction = false; 
            } 
            if (this.statement != null) 
            { 
                this.statement.Transaction = null; 
            } 
        } 
    } 
} 


>From the stack trace we know the line "this.transaction.Commit()"
throws
a new Exception.  Because the line is encased in a try/catch block, this
exception is caught and program flow is redirected to the catch block.
The catch block calls "this.RollbackImplicitTransaction()" before
throwing the exception up the call stack.  However, before the exception
can be rethrown, this.RollbackImplicitTransation() throws the
NullReferenceException.  Here is the RollbackImplicitTransaction method:


internal void RollbackImplicitTransaction() 
{ 
    if ((this.HasImplicitTransaction && (this.transaction != null)) &&
(this.transaction.Transaction != null)) 
    { 
        int transactionCount =
this.Connection.InnerConnection.Database.TransactionCount; 
        try 
        { 
            this.transaction.Rollback(); 
        } 
        catch 
        { 
            if
(this.Connection.InnerConnection.Database.TransactionCount ==
transactionCount) 
            { 
                IDatabase database =
this.Connection.InnerConnection.Database; 
                database.TransactionCount--; 
            } 
        } 
        finally 
        { 
            this.transaction.Dispose(); 
            this.transaction = null; 
            this.implicitTransaction = false; 
            if (this.statement != null) 
            { 
                this.statement.Transaction = null; 
            } 
        } 
    } 
} 

The NullReferenceException is not handled by the Firebird DLL and is
passed up the call stack to our DLL.  Consequently, we don't see the two
original exceptions, making it next to impossible to infer what caused
them.

But I was able to finally figure it out.  I was able to reproduce the
error in a multithreaded environment.  When I locked the code which
called the DLL which uses Firebird, the error went away.  Without the
lock, the error also did not occur when our SQL DLL (issuing Firebird
queries) was called serially (sequential calls rather than parallel).
But when a bunch of threads were fired up all at once, dann war die
Hoelle los.  That is to say, one thread would bomb and take the rest
with it.  Ugly.

This gave me a hunch as to what the problem was.  I tried commenting out
the "FbConnection.ClearAllPools()" statement, and voila!  End of error.

We had started clearing all pools a few years ago because we were seeing
persistent connections on our servers, because the .NET Data Provider
pools connections even after they are closed, so that they can be reused
on the next call to the database.  The pooled connection stays "alive"
on the server until the application is closed; unfortunately, since
these were web applications, they were never truly closed.  So, when any
thread issues a "clear all pools" command, it knocks the slats right out
from under all the other threads sharing the connection pool.

The solution was simply to change our connection string from
"Pooling=True" to "Pooling=False".  That fixed it.  It rendered the
"clear all pools" statement moot, although I commented it out for good
measure, even though testing showed that it didn't hurt anything to
leave it active.  The small amount of overhead incurred by not pooling
is much preferable to bombing.

Thus, it appears that connection pooling in Firebird is mighty dangerous
in a multithreading environment.  You can, to be sure, use a lock block
around all code which issues SQL commands to Firebird, and this will
also prevent the error; but it will also create a bottleneck.  Better
just to turn connection pooling off.

Comments and additional insight would be welcome and appreciated.


Meryl Streep, Stephen Colbert, Yo Yo Ma and Eva Longoria

You know their histories, now discover their roots

FACES OF AMERICA with Henry Louis Gates Jr.

Premiering Wednesday, February 10th, 8/7C

http://www.pbs.org/facesofamerica          

________________________________________________________________________
____________

 

This email may contain material that is confidential or proprietary to
PBS and is intended solely for use by the intended recipient. Any
review, reliance or distribution of such material by others, or
forwarding of such material without express permission, is strictly
prohibited. If you are not the intended recipient, please notify the
sender and destroy all copies.

________________________________________________________________________
____________

 




------------------------------

------------------------------------------------------------------------
------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the
business
Choose flexible plans and management services without long-term
contracts
Personal 24x7 support from experience hosting pros just a phone call
away.
http://p.sf.net/sfu/theplanet-com

------------------------------

_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider


End of Firebird-net-provider Digest, Vol 46, Issue 5
****************************************************


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to