-
-
Notifications
You must be signed in to change notification settings - Fork 74
Description
The following code
static void Main(string[] args)
{
TestDataBaseName("test.fdb");
TestDataBaseName("testö.fdb");
Console.WriteLine("Done");
Console.ReadKey();
static void TestDataBaseName(string dataBaseName)
{
var conString = GetConnectionString(dataBaseName);
FbConnection.CreateDatabase(conString, overwrite: true);
CreateTable(conString);
InsertData(conString);
var data = SelectData(conString);
if (data != 123)
throw new NotSupportedException();
ShutDown(conString);
Online(conString);
}
static string GetConnectionString(string dataBaseName)
{
var baseDir = AppContext.BaseDirectory;
var fbConStringBuilder = new FbConnectionStringBuilder()
{
DataSource = "localhost",
Database = Path.Combine(baseDir, dataBaseName),
UserID = "sysdba",
Password = "masterkey",
};
return fbConStringBuilder.ToString();
}
static void CreateTable(string conString)
{
using var fbConnection = new FbConnection(conString);
fbConnection.Open();
using var fbCommand = fbConnection.CreateCommand();
fbCommand.CommandText = "create table foo ( id int );";
_ = fbCommand.ExecuteNonQuery();
}
static void InsertData(string conString)
{
using var fbConnection = new FbConnection(conString);
fbConnection.Open();
using var fbCommand = fbConnection.CreateCommand();
fbCommand.CommandText = "insert into foo values (123)";
_ = fbCommand.ExecuteNonQuery();
}
static int SelectData(string conString)
{
using var fbConnection = new FbConnection(conString);
fbConnection.Open();
using var fbCommand = fbConnection.CreateCommand();
fbCommand.CommandText = "select * from foo";
return (int)fbCommand.ExecuteScalar();
}
static void ShutDown(string conString)
{
var fbConfig = new FbConfiguration(conString);
fbConfig.DatabaseShutdown2(FbShutdownOnlineMode.Single, FbShutdownType.ForceShutdown, 0);
}
static void Online(string conString)
{
var fbConfig = new FbConfiguration(conString);
fbConfig.DatabaseOnline2(FbShutdownOnlineMode.Normal);
}
}
will fail with this exception
Unhandled exception. FirebirdSql.Data.FirebirdClient.FbException (0x80004005): I/O error during "CreateFile (open)" operation for file "C:\USERS\xxx\SOURCE\REPOS\CONSOLEAPP50\CONSOLEAPP50\BIN\RELEASE\NET5.0\TESTö.FDB"
g__ShutDown|0_5(String conString) in C:\Users\rfa\source\repos\ConsoleApp50\ConsoleApp50\Program.cs:line 73
Error while trying to open file
---> FirebirdSql.Data.Common.IscException: I/O error during "CreateFile (open)" operation for file "C:\USERS\RFA\SOURCE\REPOS\CONSOLEAPP50\CONSOLEAPP50\BIN\RELEASE\NET5.0\TESTö.FDB"
Error while trying to open file
at FirebirdSql.Data.Client.Managed.GdsConnection.ProcessResponse(IResponse response)
at FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadResponse(AsyncWrappingCommonArgs async)
at FirebirdSql.Data.Client.Managed.Version10.GdsServiceManager.Start(ServiceParameterBuffer spb, AsyncWrappingCommonArgs async)
at FirebirdSql.Data.Services.FbService.StartTask(ServiceParameterBuffer spb, AsyncWrappingCommonArgs async)
at FirebirdSql.Data.Services.FbService.StartTask(ServiceParameterBuffer spb, AsyncWrappingCommonArgs async)
at FirebirdSql.Data.Services.FbConfiguration.DatabaseShutdown2Impl(FbShutdownOnlineMode mode, FbShutdownType type, Int32 seconds, AsyncWrappingCommonArgs async)
at FirebirdSql.Data.Services.FbConfiguration.DatabaseShutdown2(FbShutdownOnlineMode mode, FbShutdownType type, Int32 seconds)
at ConsoleApp50.Program.
at ConsoleApp50.Program.g__TestDataBaseName|0_0(String dataBaseName) in C:\Users\rfa\source\repos\ConsoleApp50\ConsoleApp50\Program.cs:line 27
at ConsoleApp50.Program.Main(String[] args) in C:\Users\rfa\source\repos\ConsoleApp50\ConsoleApp50\Program.cs:line 13
As you can see from the code only FbConfiguration
has an issue with the chracter ö
a normal FbConnection
works just fine.
The issue got introduced in version 7.0.0
and is still to be found in 8.0.1
, the issue only happens when connecting to Firebird Server 2.5.x
.
I am using the following version of Firebird Server
Additionally I have noticed that the error is already present in 6.7.0
, a version prior to the mentioned range of versions I have issues with, if I build the above code with net5.0
instead of net47
.
So to sum it up for Firebird Server 2.5.x
FbProvider Version | Target Framework | Issue ( yes / no ) |
---|---|---|
6.7.0 | net5.0 | yes |
6.7.0 | net47 | no ( I am here ) |
7.0.0 | net47 | yes |
7.0.0 | net5.0 | yes |
7.10.1 | net47 | yes ( updated to here ) |
7.10.1 | net5.0 | yes |
8.0.1 | net47 | yes |
8.0.1 | net5.0 | yes |
I am coming from 6.7.0
with net47
and updated to 7.10.1
and still use net47
, I have only noticed the difference between net47
and net5.0
when I wrote this demonstration code.
As a side note
The command FbConnection.CreateDatabase(conString, overwrite: true);
seem to get stuck when the file already exists, again only seems to be replicatable with Firebird Server 2.5.x
, so overwriting seem no option.
I therefor added those two lines into my GetConnectionString
method
if (File.Exists(fbConStringBuilder.Database))
File.Delete(fbConStringBuilder.Database);