Skip to content

Connection configuration

Bubi edited this page Sep 19, 2017 · 2 revisions

System.Data.Jet.JetConfiguration

Inside the static class there are various global configurations that can be used to change the ADO.Net provider for Jet

TimeSpanOffset

Default: 1899-12-30
The offset used to write TimeSpan values. Suggested value is 1899-12-30. Using this offset Microsoft Access will show only time.

IntegerNullValue

Default: Int32.MinValue
Used for UNION ALL queries. If you are not using UNION ALL queries and you are having issues with integers set to nulls, or you just need to write Int32.MinValues to database, change this to null.

OleDbDefaultProvider

Default: Microsoft.ACE.OLEDB.12.0
Used for generating connection string when not specified.

DUAL

Default: (SELECT COUNT(*) FROM MSysAccessStorage)
The DUAL table used in some Entity Framework Core generated queries.
It must be a single line table.

It can be changed to any single line query. There are 2 constants
DUALForAccdb = (SELECT COUNT(*) FROM MSysAccessStorage)
DualForMdb = (SELECT COUNT(*) FROM MSysRelationships)

That can be used to set the DUAL property.

Note for mdb users and DualForMdb
MSysRelationship is a restricted access table. The rights can be changed but if for some reason it is not possible to change rights for MSysRelationships table user can create a table with 1 record and change DUAL static property. I.e. create table dual with one and only one record

CREATE TABLE Dual (id COUNTER CONSTRAINT pkey PRIMARY KEY);
INSERT INTO Dual (id) VALUES (1);
ALTER TABLE Dual ADD CONSTRAINT DualTableConstraint CHECK ((SELECT Count(*) FROM Dual) = 1);

then change the DUAL property

JetConfiguration.DUAL = "Dual";

For more information see also https://en.wikipedia.org/wiki/DUAL_table

ShowSqlStatements

Default: false
Set to true to show every single SQL statement

UseConnectionPooling

Default: false
Set to true to use the connection pooling.

Limitations
After running DDL statements, the connection pooling should be cleared using JetConnection.ClearAll()