linq2db.LINQPad icon indicating copy to clipboard operation
linq2db.LINQPad copied to clipboard

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

Open asherber opened this issue 3 years ago • 8 comments

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."

asherber avatar May 14 '21 23:05 asherber

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 avatar May 15 '21 07:05 MaceWindu

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

MaceWindu avatar Nov 21 '21 15:11 MaceWindu

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

asherber avatar Nov 21 '21 15:11 asherber

Ok, will look into it once more

MaceWindu avatar Nov 21 '21 16:11 MaceWindu

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

MaceWindu avatar Nov 21 '21 16:11 MaceWindu

nevemind. chocolatey has older releases

MaceWindu avatar Nov 21 '21 16:11 MaceWindu

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

MaceWindu avatar Nov 21 '21 16:11 MaceWindu

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+.

MaceWindu avatar Nov 21 '21 16:11 MaceWindu