Unable to connect bundled embedded database on macOS
----------------------------------------------------
Key: DNET-744
URL: http://tracker.firebirdsql.org/browse/DNET-744
Project: .NET Data provider
Issue Type: Bug
Components: ADO.NET Provider
Affects Versions: 4.8.1.0
Environment: macOS Sierra, Firebird 2.5.6 embedded, Mono 4.8
Reporter: Daniel Martin
Assignee: Jiri Cincura
When bundling the Firebird database with a mono application, one must not
provide a user and a password in the connection string as otherwise the
libfbembed.dylib (Firebird binary) attempts to attach to the systems
security2.fdb.
The FbConnectionString class forces the client to provide a user and password
if LINUX is defined, as trusted auth does no exist on non-windows platforms.
This was locally fixed by checking the FbConnectionString.ServerType property
in FbConnectionString.Validate and FbConnectionString.FallIntoTrustedAuth.
See the provided methods below for details.
I'm not sure whether this is the correct solution or if it creates any side
effects.
----
internal bool FallIntoTrustedAuth
{
// on non-Win the UserID/Password is checked in
Validate method
get { return ServerType != FbServerType.Embedded &&
string.IsNullOrEmpty(UserID) && string.IsNullOrEmpty(Password); } // Embedded
does not require a password
}
---
public void Validate()
{
if (!ContextConnection)
{
if (
#if (LINUX) // on Linux Trusted Auth isn't available
(ServerType != FbServerType.Embedded &&
(string.IsNullOrEmpty(this.UserID) || // Embedded does not require a password
string.IsNullOrEmpty(this.Password))) ||
#endif
(string.IsNullOrEmpty(Database) && !_isServiceConnectionString) ||
(string.IsNullOrEmpty(DataSource) &&
ServerType != FbServerType.Embedded) ||
(string.IsNullOrEmpty(Charset)) ||
(Port == 0) ||
(!Enum.IsDefined(typeof(FbServerType),
ServerType)) ||
(MinPoolSize > MaxPoolSize)
)
{
throw new ArgumentException("An invalid
connection string argument has been supplied or a required connection string
argument has not been supplied.");
}
if (Dialect < 1 || Dialect > 3)
{
throw new ArgumentException("Incorrect
database dialect it should be 1, 2, or 3.");
}
if (PacketSize < 512 || PacketSize > 32767)
{
throw new
ArgumentException(string.Format(CultureInfo.CurrentCulture, "'Packet Size'
value of {0} is not valid.{1}The value should be an integer >= 512 and <=
32767.", PacketSize, Environment.NewLine));
}
if (DbCachePages < 0)
{
throw new
ArgumentException(string.Format(CultureInfo.CurrentCulture, "'Db Cache Pages'
value of {0} is not valid.{1}The value should be an integer >= 0.",
DbCachePages, Environment.NewLine));
}
if (Pooling && NoDatabaseTriggers)
{
throw new ArgumentException("Cannot use
Pooling and NoDBTriggers together.");
}
CheckIsolationLevel();
}
}
---
--
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
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider