Getting LINQ to Firebird to work - c#

I'm trying to generate an entity model from a Firebird database using the Entity Data Model Wizard, but it dies loading the data for the "Choose Your Database Objects" step with the error:
Microsoft Visual Studio
An error occurred while connecting to the
database. The database might be
unavailable. An exception of type
'System.Data.EntityCommandExecutionException'
occurred. The error message is: 'An
error occurred while executing the
command definition. See the inner
exception for details.
The inner exception caught was of type
'FirebirdSql.Data.FirebirdClient.FbException',
with this error message: 'Dynamic SQL
Error
SQL error code = -104
Token unknown - line 6, column 8
SELECT'.
The inner exception caught was of type
'FirebirdSql.Data.Common.IscException',
with this error message: 'Exception of
type
'FirebirdSql.Data.Common.IscException'
was thrown.'.'.
[ OK ]
I certainly believe it should work from this blog post on the ADO.Net team blog.
I'm able to browse tables and definitions using server explorer, so I think it's safe to discount connectivity/permissions issues, but I'm at a bit of a loss as to what else to check to get this working?

The blog post you speak about is beta version
the final release is on Jiri blog
or on Firebird
or here

According to the comment on this blog post, Firebird 1.5 is not support for LINQ to Firebird, even though it is supported version according to the Firebird website.

Related

Failed to create database Entity Framework code-first

I'm trying to create a database using Entity Framework with a code-first approach, but it fails on creating the database with this exception:
Unhandled Exception: System.Data.DataException:
An exception occurred while initializing the database. See the InnerException for details.
System.Data.Entity.Core.EntityException: The underlying provider failed on Open.
System.Data.SqlClient.SqlException: Cannot open database "X.Xcontext" requested by the login. The login failed. Login failed for user 'This-PC\ME'.
Any idea how to resolve this ?
Your user does not have permissions to create a database, you will need to contact your DBA for permissions, or depending on where you work you'll need to create a ticket to have someone create the database for you.
Well, Problem solved when I just renamed my DbContext..Don't know why,but it worked for me!

Why is SqlException severity class different from what the spec says it should be?

I'm staring into logs of our service and see that there was a bunch of exceptions like this:
System.Data.SqlClient.SqlException
Class 14
Number 40613
LineNumber 65536
Source .Net SqlClient Data Provider
Database 'OurDatabase' on server 'ourserver' is not currently available. Please retry the connection later. If the problem persists, contact customer support, and provide them the session tracing ID of 'GUID-IN-HERE'.
Okay, we should retry... I open our retry logic code and clearly that code expects Number 40613 with severity class set to 17. Documentation confirms that this error message should have severity class set to 17.
Why the difference? Is this a bug in the .NET Framework or what?
Thanks for bringing this to our attention. What you are seeing is due to a bug that's been exposed on V12. The systems should report Severity = 17 (not 14) for error 40613. We will fix this.
Please reach out to me if you have any questions.

Displaying a DataTable in C#

'An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
Additional information: Unable to connect to any of the specified MySQL hosts.'
Even though I have no errors according to C#. My program will keep displaying this error message when I try to run the program. Can some help?
As is stated in a comment: The error is that the connection to the MySQL host cannot be created (could be wrong password, wrong username, wrong serverip, wrong port being used, .... or that the mysql server is not running at all, ... thus these are the things you should check first).
Another thing is that you sounded confused that the compilation did not show any errors. You can think of it this way: When you compile the syntax and the grammatics are checked if they are ok and appropriate errors shown. BUT what values are there during a run is NOT checked. That is what is done during a run and causes the error you asked about.
Thus compilation does only check if the syntax is correct not if you really manage to connect to soemthing or if the values you are storing in the variables are the ones you expect there to be.

EntityFramework.pdb cannot be found

I have a WCF service running on azure and it gives this exception sometimes at random:
The underlying provider failed on Open.
There was no inner exception so I started looking into this. I enabled azure diagnostics so I could trace and log this exception.
I found out that this Exception is thrown whenever the following exception is thrown:
(MySql.Data.MySqlClient.MySqlException) Exception Message = "Unable to
connect to any of the specified MySQL hosts."
So I looked in to this and found out that EntityFramework.pdb cannot be found.
I tried solving this by checking Microsoft Symbol Servers. This does not solve the problem.
Some extra information :
The mysql database is made with a code first approach.
Mysql logged this :

An error occured during the pre-login handshake

I had a C# application that communicates with a database using Linq to SQL and was working just fine when I last tested it a month ago. However, it is now throwing the following exception:
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
------ Exception ------
Error: A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 0 - The received certificate has expired.)
I am digitally signing the code with a Verisign key, but it has not expired. I don't digitally sign until I build the installer, and this is occurring on my dev system in debug, so the code had not been signed.
It is also happening on other systems where the software was signed and installed. These systems access the same test database as I use on my dev system, and were working previously.
The line of code that causes the error follows:
List<req> results = new List<req>();
using (var db = new MyDbDataContext(connectionString))
{
var query =
from item in db.reqs
where item.senddate == null
select item;
results = query.ToList();
}
The error happens when I call results = query.ToList();.
I use the following connection string:
Data Source=<removed>;Initial Catalog=<removed>;UID=sa;PWD=<removed>;Encrypt=true;Integrated Security=false
I am able to connect if I set Encrypt=false, but that is not a viable solution.
Again, this worked just fine the last time I tested it a couple weeks ago. Any insights as to what might be happening would be greatly appreciated.
I managed to find a solution from this post.
Basically, I added TrustServerCertificate=True to my connection text, and everything started working again. I'm not sure why it stopped working in the first place, and if anyone knows if this will be a permanent solution or not, I would love to find out more about what happened.
Thank you to Carson63000 and Jacco for the suggestions.

Categories

Resources