fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
577 stars 146 forks source link

Error When Creating Connection to Access DB #324

Closed jon49 closed 8 years ago

jon49 commented 8 years ago

Description

Error When Creating Connection to Access DB

Repro steps

Not sure. DB is proprietary. I'll look into it though when I have more time.

Expected behavior

Am able to create a TypeProvider Type.

Actual behavior

The code:

type AccessEnglishDB = SqlDataProvider<Common.DatabaseProviderTypes.MSACCESS, @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\jon\Downloads\Data\data_7.15.16.mdb">

Produces:

Severity    Code    Description Project File    Line    Suppression State
Error       The type provider 'FSharp.Data.Sql.SqlTypeProvider' reported an error: Unspecified error    parser  C:\r\parser\parser\Databases.fs 28  

Known workarounds

Use System.Data.OleDb

Related information

Thorium commented 8 years ago

For me SQLProvider with MS Access works very well.

Does this work for you: https://github.com/fsprojects/SQLProvider/blob/master/tests/SqlProvider.Tests/scripts/MSAccessTests.fsx

jon49 commented 8 years ago

I tried the script you provided. When I run it, it works fine. But once I start writing a query against Northwind it shows the same error as before and won't give me intellisense.

Thorium commented 8 years ago

It would be nice to know more about this. If you can, please open 2 Visual Studios, other with SQLProvider.sln (and build this first and then) other with SQLProvider.Test.sln (with MSAccessTests.fsx) and attach the SQLProvider.sln to devenv.exe (or both FSI.exe:s if you run your code in interactive) and you should see the actual place where it breaks.

Just a side note Microsoft.Jet.OLEDB.4.0 works me as well.

Thorium commented 8 years ago

Ok, now I got the error. It comes from System.Data.OleDb.OleDbException.

If I have to guess, I would say that there are multiple connections opened to the database and it can handle only one at a time. That's why it works for a few seconds. It has been working, I don't know directly what has broke it. Something leaves the connection open and then CreateTypeMappings() call fails.