linq2db / linq2db.LINQPad

linq2db.LINQPad is a driver for LINQPad.
MIT License
74 stars 23 forks source link

Can't run SQL against MS Access (unable to obtain a DbFactory) #58

Closed asherber closed 1 year ago

asherber commented 3 years ago

I posted this on the LinqPad forum as well, because I'm not sure if it's a limitation of LinqPad or an issue with this driver.

When I make a connection to an MS Access db (either OleDb or ODBC), I'm able to test the connection successfully, I'm able to expand the connection node and see all the tables, and I'm able to run C# code using the connection. But if I choose SQL as the language and try to execute a straight query, I get an error, "Unable to obtain a DbFactory for the connection."

MaceWindu commented 3 years ago

Confirmed. Works with LP5.

For .net core builds we don't support DbFactory, so it could be causing issue. Still not sure why it even tries to use DbFactory in first place...

MaceWindu commented 2 years ago

Currently it works with recent linqpad 5, 6, 7. Looks like linqpad issue indeed.

asherber commented 2 years ago

@MaceWindu LP added a workaround after the issue was confirmed here (see forum post). I suspect the root cause may still be in linq2db.

MaceWindu commented 2 years ago

Ok, will look into it once more

MaceWindu commented 2 years ago

Hmm, but now I cannot reproduce it as linqpad site doesn't host old releases...

MaceWindu commented 2 years ago

nevemind. chocolatey has older releases

MaceWindu commented 2 years ago

Not actionable. I have no linqpad 6.13 anymore and linqpad site doesn't host older releases

MaceWindu commented 2 years ago

Ok, figured out what could be wrong. We don't implement GetProviderFactory, and linqpad driver dev. guide states:

You must override GetProviderFactory if you want SQL querying support, because DbProviderFactories.GetFactory returns nothing in .NET Core 3.1+.