DBNull issue with Oracle 11g ODP.Net provider - oracle11g

We are facing problem in checking output parameters for “DBNull”. “DBNull” value returned by Oracle stored procedure or function is treated as “null” string by oracle 11g client/ODP.Net provider. This works fine with oracle 10g client as it returns “DBNull”.
Because of this all our “DBNull” check fails

ODP.NET RETURNING "NULL" STRING WHEN THE VALUE IS NULL [ID 968857.1]
Modified 04-JAN-2010 Type PROBLEM Status PUBLISHED
In this Document
Symptoms
Changes
Cause
Solution
Applies to:
Oracle Data Provider for .NET - Version: 10.2.0.2.20 to 11.1.0.7.10
Microsoft Windows (32-bit)
Microsoft Windows x64 (64-bit)
Symptoms
After migrating from a previous version of Oracle Data Provider for .NET, a change in behavior may occur with respect to null values being retrieved. Whereas the application previously returned an empty string, a string with the value "null" is now obtained.
Changes
Migration from 1.x ODP.NET to 2.x ODP.NET
Cause
The behavior is due to a migration from the 1.x Oracle Data Provider for .NET to the 2.x provider. 2.x ADO.NET supports the ability of the provider to return provider specific types, and this is one of the potential "breaking changes" going from .NET 1.x to 2.x.
ODP.NET versions 9.2.x, 10.1.x, 10.2.0.1.0 were all 1.x framework providers. Typically this behavior is noticed when migrating from an early version ODP to a newer version of ODP, but at the same time swtiching from the 1.x provider to the 2.x provider. It is the change in .NET framework support rather than the change in Oracle client version that causes this behavior.
This behavior may also be noticed migrating the application to a 64 bit operating system, as there is no 1.x 64 bit framework.
Solution
To resolve this behavior, the code will need to be modified.
As a workaround, using ODP.NET for 1.x (1.111.7.0 for example instead of 2.111.7.0) will result in the previous behavior, but note that the 1.x provider is not tested or supported on any version of framework other than 1.x, and that support for 1.x is not planned for any version later than 11.1.0.7.0
If the operating system is 64 bit, the application will need to be forced to run under the SYSWOW64 subsystem (ie, as 32 bit) in order to use 1.x ODP.NET.
To correct the code:
If the value is a DbType, you can check for param.Value==DbNull.Value
If the value is an OracleDbType, you can check for ((INullable)param.Value).IsNull since Oracle Types inherit INullable interface.

Following the breaking change that Oracle released (see comment below). You need to add the additional bit below:
if (oraParam[7] == null ||
oraParam[7].Value == DBNull.Value ||
((INullable)oraParam[7].Value).IsNull)
INullable is in the Oracle.DataAccess.Types namespace.

Or you can try...
(OracleString)result == OracleString.Null

Related

Does the latest version of System.Data.Sqlite not support password encryption?

I've got a .Net Core appl and am using the System.Data.SQLite.dll package to connect to a SQLite DB.
I'm trying to encrypt the database with a password.
In version 1.0.93.0 of System.Data.SQLite.dll library I can set or change the password encryption of the database:
SQLiteConnection con = new SQLiteConnection($"Data Source=DBName;Version=3;");
conn.SetPassword($"{password}");
conn.ChangePassword($"{password}");
conn.Open();
In the latest version 1.0.113.7 the api's no longer to appear to be supported.
Visual Studio throws a compiler error on the SetPassword() and ChangePassword() calls.
How do I password encrypt my databases?
Is there another way to achieve this using this library (or something similar)?
Yes, it seems that starting with System.Data.SQLite version 1.0.113.0, support for encryption in this way was entirely removed in this checkin, by modifying the file /Targets/SQLite.NET.Settings.targets, and setting the value of InteropCodec to false.
Specifically the comment says "Merge all changes needed for the SQLite core library 3.32.0 release."
This reveals to us that the actual culprit is SQLite itself, where in release 3.32.0, they removed support for this type of encryption API as well, in this commit, where the comment says "simplify the code by removing the unsupported and undocumented SQLITE_HAS_CODEC compile-time option"
Neither the change in System.Data.SQLite nor in SQLite are documented in the release notes for these projects.
In prior versions of System.Data.SQLite, such as 1.0.112.1 and earlier, encryption via the SetPassword() method was supported, and this used the “SQLite Encryption Extension” (SEE)

Is mariadb-java-client 2.2.3 compatible with MySQL 8.0?

I'm using mariadb-java-client 2.2.3 to connect to a MySQL server 8.0.11. I'm also using spring-boot 2.0.2. for the application.
On application startup, I'm getting the following execption:
java.sql.SQLException: (conn=9) Unknown system variable 'tx_isolation'
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:198) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.getException(ExceptionMapper.java:110) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:228) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:334) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbStatement.executeQuery(MariaDbStatement.java:505) ~[mariadb-java-client-2.2.3.jar:na]
at org.mariadb.jdbc.MariaDbConnection.getTransactionIsolation(MariaDbConnection.java:859) ~[mariadb-java-client-2.2.3.jar:na]
According to the MySQL link below, the system variable 'tx_isolation' that was previously deprecated has now been removed. 'transaction_isolation' should be used instead.
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-3.html
Is there a workaround for this issue?
Thanks.
There is no workaround for the moment. Issue has been created on https://jira.mariadb.org/browse/CONJ-604 to handle that for next version 2.2.5.
Currently, MySQL 8.0 is not supported (some tests even freeze the server), so waiting version to be more stable (and a working docker image to test properly with CI).
For people who switch from MySql to MariaDb on their existing SpringBoot project, and face the same issue:
Upgrading mariadb-java-client to 2.6.0+, in your pom.xml solve the issue (most tutorial on the net has 2.1).

Unity's ResolutionFailedException

I have an old Asp.Net web application using Unity for dependency injection.
Today I updated the Unity using NuGet to the latest version. On trying to run the application, I am getting an exception:
Unity.Exceptions.ResolutionFailedException: 'Resolution of the dependency failed, type = 'SOME.Services.ISomeService', name = '(none)'.
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The property converter on type DAL.Repositories.SomeRepository is not settable.
The exception happened on line
_someService = container.Resolve<ISomeService>();
I am very new to Unity. Could you please help?
The newer versions of Unity have breaking changes.
You may want to stick with the older versions of the DLL until you refactor the changes.
v4.0.1 Version 4.x is dead. Loss of original signing certificate made
it impossible to release anything compatible with v4.0.1 release. To
give original developers a credit only about 60 issues were found
during two years in production. To move on and enable further
development version v5 has been created.
v5.x Version 5.x is created as replacement for v4.0.1. Assemblies and
namespaces are renamed and refactored but otherwise it is compatible
with the original. v5.0.0 release fixes most of the issues found in
v4.0.1 and implements several optimizations but the accent was on
compatibility and if optimization would break API it was omitted. Once
stabilized, this version will enter LTS status and will be patched and
fixed for the next few years. There will be no significant development
in this line.
Check their road map here.

EntityFramework 7 - CodeFirst - SQLite - Manage DB using ApplyMigrations at runtime

I am well on my way to utilizing EF7 CodeFirst with SQLite...but really want to employ DB Migrations at runtime. This is a desktop application (Click-once deployment) meant to sync with a main database when connection is available, and provide offline data when no connection is present.
I have pulled down the nuget pre-release versions and all is working, except I cannot find any documentation of how to apply the migrations at runtime. I can successfully Add-Migrations and manually Apply-Migrations...but need a way to programatically Apply-Migrations at runtime.
I've also browsed the EF7 open-source project, but could not get anywhere there.
Versions I'm using: Latest Pre-release as of 9/15/2015
EntityFramework.Sqlite v7.0.0-beta7
EntityFramework.Relational v7.0.0-beta7
EntityFramework.Commands v7.0.0-beta7
...et al...you get the picture.
I am asking for help to apply runtime migrations...or what is the documented/recommended path for programatically maintaining a local/embedded db using EF7 CodeFirst SQLite?
UPDATE:
I went back to EF6 with SQLite but then found out that there is not SQLMigrationGenerator for SQLite.
EDIT:
I believe ApplyMigrations() method referenced in one of the notes has been deprecated. Searching the repository, there is no reference to "ApplyMigrations".
Today you can invoke the extension method Migrate on the DatabaseFacade.
This method is only available when the using Microsoft.Data.Entity statement is present. It comes from the RelationalDatabaseFacadeExtensions class that is part of the EntityFramework.Relational package.
Still have to find out how to migrate up and down from the API.

ASP.NET using AtalaSoft to convert Tiff compression

Using Atalasoft's free SDK,
http://www.atalasoft.com/free-dotnet-image-sdk
I added reference to the DotImage and DotImage.Lib dlls' to Visual Studio 2010.
My code:-
Atalasoft.Imaging.AtalaImage image = new Atalasoft.Imaging.AtalaImage(fileName);
Atalasoft.Imaging.Codec.TiffEncoder encoder = new Atalasoft.Imaging.Codec.TiffEncoder();
encoder.Compression = Atalasoft.Imaging.Codec.TiffCompression.Group4FaxEncoding;
image.Save(fileName, encoder, null); // destroys the original.
However when I run the code I get an error on the very first line:-
Unable to retrieve security descriptor for this frame.
Can anyone help me out with this?
Update:-
I added a further line of code:-
System.Security.Permissions.FileIOPermission f2 = new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.AllAccess, fileName);
Still the same error.
Philo,
Hi, I'm the support engineer you called in to yesterday. I apologize - after you called in, I received a note from our chief software architect asking us to help you out.
If you are still experiencing your issue, please do call back in and/or create a support case on our portal at https://www.atalasoft.com/support/my-portal/cases
A couple of tings that come to mind from your case: make sure you're targeting either x86 or x64 in your project's platform target (DotImage "has bitness") and make sure you're using the appropriate x86 or x64 Atalasoft references. (I strongly suggest our x86 while getting started as x64 has some additional hoops to jump through to get the licensing working.
Atalasoft does ship some AnyCPU dlls but they're for an extremely limited subset of use cases and if you have referenced those and/or are attempting to target your project to AnyCPU, this will cause all sorts of odd behavior.
Also, if you're targeting our .NET framework 4.0, make sure you're targeting the full framework and not "Client Profile" as DotImage has dependencies on components not present in the Client Profile version.
~DigitalSorceress
Did you have the the file with .lic extension in project section on the right side? Make sure about that.

Resources