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

Support all MySql.Data Connection String options #105

Closed
bgrainger opened this issue Oct 17, 2016 · 18 comments
Closed

Support all MySql.Data Connection String options #105

bgrainger opened this issue Oct 17, 2016 · 18 comments

Comments

@bgrainger
Copy link
Member

bgrainger commented Oct 17, 2016

From Connection String Options Reference:

Option Status Issue Comments
AllowBatch it's true by default, and there doesn't seem to be much point in supporting false
AllowLoadLocalInfile ✔️ #643 New in 8.0.16
AllowLoadLocalInfileInPath #899 New in 8.0.22
AllowUserVariables ✔️
AllowZeroDateTime ✔️ #507
AutoEnlist ✔️ #13
CacheServerProperties optimisation for Connector/NET because it always retrieves @@max_allowed_packet, @@character_set_client etc. when connecting
CertificateFile ✔️ #88
CertificatePassword ✔️ #88
CertificateStoreLocation ✔️ #536
CertificateThumbprint ✔️ #536
CharacterSet hard-coded to utf8mb4 in this connector; unclear if being able to use a different encoding on the wire has clear benefits
CheckParameters true by default; check parameters=false seems to be recommended only as a work around for Connector/NET bugs or MySQL permission problems
CommandInterceptors #420
ConnectionLifeTime ✔️ #212
ConnectionReset ✔️
ConnectionTimeout ✔️ #57
Connect_Attrs Documented, but not supported by Connector/NET
ConvertZeroDateTime ✔️
Database ✔️ aka InitialCatalog
DefaultAuthenticationPlugin new in 8.0.26; "is mandatory for supporting userless and passwordless Kerberos authentications" which isn't a supported feature of MySqlConnector
DefaultCommandTimeout ✔️ #67
DefaultTableCacheAge see remarks on TableCache
DnsSrv #761 see remarks on #761
EnableSessionExpireCallback default is false; manipulates my_aspnet_sessions table
Encrypt this setting is deprecated
ExceptionInterceptors #420
FunctionsReturnString default is false; unaware of any clients that need this
Host ✔️
IgnorePrepare ✔️ #534
includesecurityasserts for partial trust environments
InteractiveSession ✔️ #510
IntegratedSecurity Windows-only
Keepalive ✔️ #145
Logging Implemented custom logging framework
MinimumPoolSize ✔️ #85
OldGuids ✔️ #26
OldSyntax this setting is deprecated
OpenidIdentityToken #1517 only supported by Enterprise Edition server
Password ✔️
Password1, Password2, Password3 #1068
PersistSecurityInfo ✔️
PipeName ✔️ #454 Windows-only
Pooling ✔️ #2 also MaximumPoolsize
Port ✔️
ProcedureCacheSize Cached procedures are very small objects; enforcing a limit of 25 seems unnecessary
ConnectionProtocol Only socket and unix are supported (and auto-detected)
Replication not well documented; this just seems to ensure (client-side) that only read-only commands are executed
RespectBinaryFlags true by default
SharedMemoryName Windows-only
SshHostName, SshPort, SshUserName, SshPassword, SshKeyFile, SshPassPhrase #671 New in 8.0.17; removed in 8.0.24
SslCa ✔️ #640 New in 8.0.16
SslCert ✔️ #641 New in 8.0.16
SslKey ✔️ #641 New in 8.0.16
SslMode ✔️ #88
Sql Server Mode Enables square brackets instead of backticks; seems unnecessary
TableCache Only supported by Connector/NET for CommandType.TableDirect; seems low-value; caching is better handled at the application layer
tlsversion ✔️ #760 New in 8.0.19
TreatBlobsAsUTF8 only necessary for connecting to pre-5.5.3 servers that don't support utf8mb4; also includes BlobAsUTF8ExcludePattern, BlobAsUTF8IncludePattern
TreatTinyAsBoolean ✔️ #141
UseAffectedRows ✔️ #104
UseProcedureBodies this setting is deprecated
UserID ✔️ aka User name
UseCompression ✔️ #31
UseUsageAdvisor Recommend using third-party DB profiling tools
UsePerformanceMonitor Windows-only
@caleblloyd
Copy link
Contributor

AFAIK, ConvertZeroDateTime and ConnectionReset are also done

@mguinness
Copy link
Contributor

mguinness commented Dec 3, 2016

What is the possibility for getting "Treat Tiny As Boolean" support?

System.InvalidOperationException: Option 'treattinyasboolean' not supported.

Is the current handling set to true? I'm having an issue with Pomelo.EntityFrameworkCore.MySql when tinyint(1) is used.

System.InvalidCastException: Unable to cast object of type 'System.Boolean' to type 'System.SByte'.

Edit: I located the code to change and I found what the official connector does.

@bgrainger
Copy link
Member Author

The current default for TreatTinyAsBoolean is true in this library (same as Connector/Net); it can't currently be configured. Opened #141 for adding it.

@bgrainger
Copy link
Member Author

(FWIW, converting TINYINT(1) to bool only happens when the column length is explicitly 1. A TINYINT or TINYINT(2) column shouldn't be converted in this way.)

@mguinness
Copy link
Contributor

@bgrainger Thanks, that's the workaround I'm currently using. Also TINYINT will end up as TINYINT(3) (to avoid any confusion).

@AccessViolator
Copy link

The link in the first post is dead, this is the current one
https://dev.mysql.com/doc/connector-net/en/connector-net-8-0-connection-options.html

@bkonia
Copy link

bkonia commented Dec 16, 2019

Are you planning to support the TableCaching option? I'm surprised this isn't supported, particularly since this library emphasizes performance. In many scenarios, table caching could make reading hundreds of times faster.

@mguinness
Copy link
Contributor

mguinness commented Dec 16, 2019

Have you previously used the Table Caching option with Connector/NET? The documentation seems very sparse and the only scenario I'd see it being compatible with is when CommandType.TableDirect is used.

UPDATE: I just looked at the source code for MySqlDataReader class and that is indeed the limitation.

If that's the usage then you might just as well implement the caching yourself in your own application.

@bkonia
Copy link

bkonia commented Dec 16, 2019

OK, I understand.

@jemiller0
Copy link

The data may not be changed frequently, but, it does change. In my apps, I would rather have accurate data. So, I would be inclined to stay away from something like that. Particularly, for something like user or role information. I guess it depends on what the cache timeout is.

@mguinness
Copy link
Contributor

There are only two hard things in Computer Science: cache invalidation and naming things.
 
-- Phil Karlton

@bgrainger
Copy link
Member Author

@mguinness Thanks for the analysis; I had not researched the TableCache option until now.

@bkonia Caching seems like an application-level concern that should be handled at a higher level, not a feature of an ADO.NET library. (I'm not aware of an analogous option in any other ADO.NET library.) Also, since this is effectively a no-op for almost all Connector/NET queries (I suspect very few clients actually use CommandType.TableDirect) I do not plan to implement this connection string option. I've updated the table above accordingly.

@AccessViolator
Copy link

This is typically referred to as 2nd level cache. Some ORMs, e.g. NHibernate, implement it, EF6/Core don't, though there are extension packages.

Somewhat off topic: I personally prefer to steer clear and do things like user profile caching on application level. Some modern web API apps using JWT auth may not need it at all - depends on whether you need any sensitive user data on your every API request or not. If you do, cache in the app, if you don't just add to your JWT. That's actually one of the main "selling points" of JWTs compared to traditional session IDs - to be able to avoid hitting the DB on every request.

@bgrainger bgrainger pinned this issue Jun 2, 2020
@bgrainger bgrainger unpinned this issue Jun 2, 2020
@bgrainger
Copy link
Member Author

Every option is either implemented, deliberately not implemented, or (just one: SSH settings) isn't implemented yet but has a documented workaround.

@langfordcd
Copy link

Any plans for supporting DefaultAuthenticationPlugin?

@bgrainger
Copy link
Member Author

Any plans for supporting DefaultAuthenticationPlugin?

What's the use case where you'd want to use it?

@langfordcd
Copy link

As I understand, it's required for password-less Kerberos authentication.

@bgrainger
Copy link
Member Author

Right, but MySqlConnector doesn't support authentication_kerberos_client so what would be the point?

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

No branches or pull requests

7 participants