Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect to database if there is an existing connection. [DNET1030] #943

Closed
firebird-automations opened this issue Mar 7, 2021 · 18 comments

Comments

@firebird-automations
Copy link

Submitted by: Joshua Ellis (ellis95)

I have Firebird DBs on multiple industrial machines where the PLC is constantly logging data to the Firebird DB located in a Windows environment. If I use the http://ADO.net connector it refuses to connect to the database because of an existing connection. I tried this on my own computer with the same results, any connection to the database using flamerobin, the IBPP library, etc would make the .net library unusable. However using the IBPP library and writing the connection works just fine with no issues. I also have code running in C++ that works fine and is able to read database contents if there are multiple connections to the database. It would be nice to see this library support multiple connections to a DB no matter what else is connected to the DB it is trying to connect to. I am using Firebird 2.5 I have also replicated the issue with Firebird 3.0

@firebird-automations
Copy link
Author

Modified by: Joshua Ellis (ellis95)

description: I have Firebird DBs on multiple industrial machines where the PLC is constantly logging data to the Firebird DB located in a Windows environment. If I use the http://ADO.net connector it refuses to connect to the database because of an existing connection. I tried this on my own computer with the same results, any connection to the database using flamerobin, the IBPP library, etc would crash the .net connection. However using the IBPP library and writing the connection works just fine with no issues. I also have code running in C++ that works fine and is able to read database contents if there are multiple connections to the database. It would be nice to see this library support multiple connections to a DB no matter what else is connected to the DB it is trying to connect to. => I have Firebird DBs on multiple industrial machines where the PLC is constantly logging data to the Firebird DB located in a Windows environment. If I use the http://ADO.net connector it refuses to connect to the database because of an existing connection. I tried this on my own computer with the same results, any connection to the database using flamerobin, the IBPP library, etc would make the .net library unusable. However using the IBPP library and writing the connection works just fine with no issues. I also have code running in C++ that works fine and is able to read database contents if there are multiple connections to the database. It would be nice to see this library support multiple connections to a DB no matter what else is connected to the DB it is trying to connect to. I am using Firebird 2.5 I have also replicated the issue with Firebird 3.0

@firebird-automations
Copy link
Author

Commented by: @cincuranet

What does "refuses to connect" mean? You should provide a code and an error you're seeing.

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

Sorry forgot to include that. I will give you an error message today.

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

The error is 'I/O error during "CreateFile(open) operation for file "/file path/.fdb" Error while trying to open file'

Inner Exception
IscException: I/O error during "CreateFile(open)"

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

This sounds like a support question. My guess would be that one of the applications is connecting using an embedded connections, and the server is SuperServer mode, thus has an exclusive lock on the database. For Firebird 3 this can also happen if both applications use Embedded, because in the default config of Firebird 3, Embedded also applies SuperServer mode.

For Firebird 3.0, you would need to configure the ServerMode to SuperClassic or Classic (for both embedded and normal server), for Firebird 2.5 you need to make sure Firebird Server is Classic or SuperClassic; alternatively, you need to make sure all connections go through the server and none are using an embedded connection.

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

Thanks Mark not sure where I would ask a support question though. Both are running Server not embedded, on the machine it is running server as well.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Component: NuGet packages [ 10150 ] =>

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Yes, Mark is right. This is purely about how the connection is made and how server (or Embedded) handles that. Provider is just doing what it is told to do. In fact the error is from Firebird, not from the provider.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => Closed [ 6 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

You can use firebird-support list (https://firebirdsql.org/en/mailing-lists/). Or alternatively StackOverflow where the Firebird community as active as well.

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

Thanks Mark and Jiri I will do that. It does seem it keeps trying to default to a Firebird embedded connection though I am trying to direct it at the server. I will ask the mailing lists, as this quite odd it is behaving this way.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Since Firebird 3, connection strings that are only a file path when connecting using fbclient.dll or http://libfbclient.so will use the embedded engine if it is available. That is assuming the other application is not using the http://ADO.net provider to connect. Alternatively, you are running two different Firebird servers attempting to connect to one and the same database file.

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

I am not sure everything works in C++ and other connections flawlessly and I am using the default instance and I will just get missing .dll. And if I switch it back it defaults to embedded is missing. I do not want to use embedded only the server but it is not working properly on my machine for some reason. I will revert back to c++ for now as it is working with no issues

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

The default of the http://ADO.net provider uses the wire protocol to connect to a server, and does not use embedded unless you explicitly set the ServerType in the connection string, which specifies whether the provider connects using the wire protocol or uses Firebird Embedded. The ServerType in the connection string does not relate to the server mode I mentioned in my earlier comment. Server mode is a specific installation of the engine (Firebird 2.5 and earlier), or a configuration in firebird.conf (Firebird 3 and higher).

Unless you were already using ServerType=Embedded in your connection string, your problem is likely that your *other* application is using Firebird Embedded, or you're using two Firebird servers trying to access the same database.

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

Thanks Mark, the only thing that it could be is they are using two different servers as the database itself is using the regular server instance for 2.5. The http://ADO.net connection states that the server doesn't exist even though everything is installed and set up by default settings. But the server exist as the database works fine, trying to redirect the .net connector to the server has not worked yet.

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

This is why I assumed it was a bug it is not using the default instance of the server and I have been unable to force it to do so.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Could you please take this to https://groups.google.com/g/firebird-net-provider?

@firebird-automations
Copy link
Author

Commented by: Joshua Ellis (ellis95)

Done, thanks Mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants