Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Duplicate
-
3.2.0, 3.2.1, 3.2.2
-
None
-
Windows 11. .NET6.0
Description
Updating the driver to 3.2 from 3.1 changes the exception thrown when database already exists to a less informative System.AccessViolationException, instead of the previous more informative System.Data.Odbc.OdbcException.
Expected behavior:
Exception thrown:
{{System.Data.Odbc.OdbcException
Can't create database 'my_database'; database exists}}
Actual behavior
Exception thrown:
{{System.AccessViolationException
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.}}
Code to reproduce (just fill in the server, port, username and password):
private static void Main() |
{
|
const string driver = "MariaDB ODBC 3.2 Driver"; |
const string database = "my_database"; |
const string user = ""; |
const string password = ""; |
const string server = ""; |
const string port = ""; |
|
const string connectionString = $"Driver={driver};integratedsecurity=False;database=;uid={user};PWD={password};server={server};port={port};sslmode=DISABLED;no_cache=1;forward_cursor=1;no_schema=0;schemanoerror=1"; |
|
|
var commands = new[] { $"CREATE DATABASE {database};", $"CREATE DATABASE {database};" }; |
|
try |
{
|
using var connection = new OdbcConnection(connectionString); |
connection.Open();
|
foreach (var commandText in commands) |
{
|
using var command = connection.CreateCommand(); |
command.CommandText = commandText;
|
command.ExecuteNonQuery();
|
}
|
}
|
catch (Exception ex) |
{
|
Console.WriteLine($"Caught exception:\n{ex}"); |
}
|
|
Console.WriteLine("Program ran to completion"); |
}
|
Attachments
Issue Links
- is duplicated by
-
ODBC-429 AccessViolationException when executing a SELECT on a non existing table
- Closed