-
Notifications
You must be signed in to change notification settings - Fork 38
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
How to configure the provider to use ADOX? #109
Comments
Can I ask what bitness you are compiling your program for? Any CPU,x86 or x64? It's just that |
I am using the Any CPU Platform Target, but I still got the same error when setting that to x86. If I understand the ecosystem around access correctly this may still run into problems if the access drivers are installed in x64 on the target machine.
This issue is known but I have to work with an old mdb-file. As far as I know I cannot just replace that with an |
it's not possible to create a database using an OLEDB connection so (as far as I remember) the provider creates an |
Thanks @bubibubi for that info. Also @xoniuqe just to confirm, if you already have a mdb file, you are able to connect to it using OLEDB? If not, go to Build -> Configuration Manger, and make sure that the target platform for your project is set to x86. It IS possible to have a project to have a different target platform to the main target platform that shows in the menu area (.e.g. I have a solution that is set to Any CPU, but the specific project that needs to access oledb is set to x86 Alternative solution - not sure if this would work for your scenario or not. Have a blank mdb file stored somewhere as a template. Then when you need it, create a copy where you want it. Then you should be able to open it as normal and do whatever modifications it needs |
@xoniuqe As already stated above, To ensure you are running in a 32 bit process, check the return from Here are two links for 64 bit versions:
The compatibility of the 2010 version goes way back. In case you want to use OLE DB as the data access provider (you have the choice between OLE DB and ODBC), and you want to explicitly specify the connection string, use If you don't specify the OLE DB provider string, we will use the newest provider available.
Do you mean that you have to use the MDB file format, or that you have to use a very old MDB file format? If it is the former, than any of the posted links (including the 2016 redistributable) will work for your 64 bit scenario. If it is the latter, what specific Jet versions do you need to support (or what are the exact requirements that you have)?
To support database creation and migrations for Jet as best as possible, we have to use both: DAO and ADOX. The reason is, that Microsoft once implemented everything Access related into DAO, than created ADO/ADOX as a successor to DAO (while ODBC was phased out in favor of OLE DB) and implemented newer Jet features into it, and finally later decided, that its not worth it and made DAO the primary library for Jet again, but without implementing every feature that has been made available using ADO/ADOX in the meantime. We have two implementation under the hood, one using DAO and one using ADOX. Both have been implemented as complete as possible, but some features are only fully available using one of the two implementations. We therefore have a bridge class, that chooses the right implementation for the task at hand. When it comes to database creation, in 99% of cases, it should not matter which implementation you are using.
The officially supported database creation call would be |
I am currently running in an issue on Windows 10 x64 machines which have seemingly no DAO drivers on them.
If I try to create the database via the IMigrator I get the following exception:
(FYI my connection string:
Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin; Data Source={0};Mode=Share Deny None;Jet OLEDB:Database Password={1}
and I use the.UseJetOleDb
Method to create the context)After a bit of playing around I found that if just force the creation of the database via
JetDatabaseCreator.CreateInstance(SchemaProviderType.Adox).CreateDatabase(String.Format(CultureInfo.InvariantCulture, StaticDatabaseSettings.cCConnectionString, pDatabasePath, StaticDatabaseSettings.cCDatabasePassword));
Everything works just fine.
Here my question: Is this the intendet way of forcing this? Is this bad? What are alternative solutions?
For completion the code context where the issue occurs:
The text was updated successfully, but these errors were encountered: