Did some research on this, but didn't find much on this topic.
I am writing an Import function to convert an SQLite database to SQL database. In the CLI version it works fine, in the Web version it falls flat on its face with an isolationLevel error. Since this is an import function it will read multiple different (same layout, version, structure; different data) sqlite databases.
The issue is when running as a Web site (multi project solution), I get 'System.Data.SQLite isolationLevel Exception' When the CLI component (standard command line app) runs. It reads the database correctly and continues on.
var connectionString = new SQLiteConnectionStringBuilder
{
DataSource = contract.FileRecord.FullPath(),
ReadOnly = true
};
var sqlHandler = new SQLiteConnection(connectionString.ConnectionString);
sqlHandler.Open();
var data = processData(sqlHandler);
sqlHandler.Close();
sqlHandler.Dispose();
Connection String is the absolute path to the database file. The database file does change depending on what is used. But the all database files have the same layout (different data).
I have tried specifying the isolation level but it still fails.
DefaultIsolationLevel = IsolationLevel.Serializable
Outside of farming this work out to the CLI in its own process, is there any way to resolve the error in the Web side?
More Specifics if needed
Multi-Project Solution
All .Net 4.5.2 targeted
VS2015
The core project that has the Import functionality (And db calls) have SQLite referenced.
The web project defines the SQL 2014 connection (working as intended)
Any ideas on how to resolve that error? (I'd give you more on the error, but that is all I get from VS2015)
Thanks!
Related
I know the problem with ORA-28040: No matching authentication protocol
was discussed here plenty of times, but from I can gather all of the provided solutions (like sqlnet.ora edition or replacing ojdbc14.jar with another one) were to made on the server side.
Unfortunately I am not permitted to interfere with the server in any way.
I had some nice simple tool to read records from different DBs and compare them. Connecting to DB is done by:
using System.Data.OracleClient;
...
using (OracleConnection connection = new OracleConnection(conString))
{
connection.Open();
...
}
Now it throws aforementioned exception.
I will appreciate any way to replace this code with something which will actually connect to Oracle 12c.
I tried "dotConnect for Oracle 9.4 Express" from Devart but it gave the same error.
Thanks for any ideas!
I've found it.
Instaling Oracle Data Provider for .NET from ODAC 12.2c Release 1 and Oracle Developer Tools for Visual Studio (12.2.0.1.0) did the trick.
And remember about this:
"After installation add a reference of the assembly
Oracle.DataAccess.dll."
I've been attempting to create a table through my machine's Azure storage emulator. I can recreate the problem with a very simple program that uses only WindowsAzure.Storage nuget version 6.2.0 :
using Microsoft.WindowsAzure.Storage;
namespace StorageEmulatorTest
{
internal class Program
{
private static void Main(string[] args)
{
var cloudStorageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
var cloudTableClient = cloudStorageAccount.CreateCloudTableClient();
cloudTableClient.GetTableReference("JohnnyTest").CreateIfNotExists();
}
}
}
After 25 seconds, this will throw an exception of type Microsoft.WindowsAzure.Storage.StorageException with only this message:
The remote server returned an error: (500) Internal Server Error.
I have attempted:
Ensuring my WindowsAzure.Storage nuget package is the latest version (6.2.0).
Re-installing the Azure SDK for VS2015 2.8.1 (and ensuring that it's the latest version)
Stopping, clearing, initing the Azure Storage Emulator through the Azure Storage Emulator command line tool (seemed to work fine, no errors)
Reading the web response's stream through the exception's ".InnerException.Response.GetResponseStream()". This fails with an exception that states "Stream was not readable".
Restarting my machine (desperation kicked in)
My bag of tricks is running low. Has anybody encountered this issue?
I solved it. I had to completely wipe out my existing local storage emulation instance. Using "AzureStorageEmulator.exe clear" or "AzureStorageEmulator.exe init" was insufficient. Even uninstalling the Azure SDK was insufficient.
I started by stopping the storage emulation:
AzureStorageEmulator.exe stop
AzureStorageEmulator.exe clear
AzureStorageEmulator.exe init /forceCreate
That last command errored and indicated that it could not create the database.
Then I deleted (actually, I renamed them) these remaining files that comprised the database behind the azure storage emulator:
C:\Users\[Me]\AzureStorageEmulatorDb42_log.ldf
C:\Users\[Me]\AzureStorageEmulatorDb42_log.mdf
Finally, I started the emulator back up
AzureStorageEmulator.exe init /forceCreate
AzureStorageEmulator.exe start
Success!
I'm unsure what got me into the situation, but my best guess is that this was caused by a recent upgrade of the Azure SDK.
I think in many cases Johnny's answer will solve the issue.
In my case this also did not work, because AzStorageEmulator did not create the database AzureStorageEmulator510 (database instance (localdb)\MSSQLLocalDB) and also not the tables within.
So I used SSMS to create database AzureStorageEmulator510 from scratch,
then I found that an older version AzureStorageEmulator57 was still on my PC, so I attached it (you can find the databases in C:\Users\YOURACCOUNT) - extracted the database structure to a SQL script and ran it for AzureStorageEmulator510.
After that, I started the emulator and created a new blob container using AzStorageExplorer.
The Error 500 seemed to occur because that database (and structure inside) was missing and could not be recreated by the CLI command AzureStorageEmulator.exe init /forceCreate.
Other things you can check (possible issues):
It can also be AzStorageEmulator can't access its database. One of the reasons (and how it can be fixed) is described here.
After installing a newer version of the instance (localdb)\MSSQLLocalDB, it can be that the related database is not attached. This will result in a strange error like
Cannot open database "AzureStorageEmulator510" requested by the login. The login failed. Login failed for user 'YOURACCOUNT'.
If that is the case, you can fix it by simply connecting to localDb via SSMS, then attach the database: Right-click on databases, select Attach... in the context menu, then in the dialog, add the database file (located in C:\Users\YOURACCOUNT).
I use EF5 over SQLite database (using System.Data.SQLite 1.0.90.0). The entities are exposed via OData service
public sealed class MyService : DataService<MyEntities>
When I query my entities from inside my app it works ok, for example
using (var ents = new MyEntities)
{
var count = ents.SomeEntity.Select(ent => ent).Count();
}
When I send a request from browser like this
http://localhost:8737/MyService/SomeEntity
it also works fine, it returns me the list of my entities.
But when I create a following request
http://localhost:8737/MyService/SomeEntity/$count
OR
I query the service by service reference from some client app (and my query contains Count()), I get an Exception
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SQLite.SQLiteException: SQL logic error or missing database
no such function: BigCount
I suppose that when the SQL request is generated it contains aggregate function BIGCOUNT which SQLite doesn't have. If I change my database provider to SQL Server, then everything is absolutely fine. I don't know what I can do to change the way the request is generated. I tried to switch to Entity Framework 6 + System.Data.SQLite 1.0.94.0 but it's no use. I tried to stick to EF5 and change the versions of System.Data.SQLite to previous ones but nothing changed. The only difference I had was that my earlier problem was "solved" (in quotes because I would not call something I don't understand a solution) when I used the EF6+SQLITE1.0.94.0.
UPDATE 23/12/2014
We solved this problem by examining the System.Data.SQLite sources, finding the place where the "bigcount" keyword was incorrectly used, fixing it for our needs and then rebuilding the library.
As stated here the BigCount should be compiled to COUNT() in all databases except SQL Server. It looks like BigCount was compiled just to BigCount, or sth like that.
Rebuilding the library turned to be tricky itself, and since I'm only a little Junior yet, so my Team Lead did that part and I can't tell the details, which I didn't have time to dive deeper in. At least, it's a direction you can use to solve the same problem.
I also encountered the error SQL logic error or missing database\r\nno such function: BigCount and here are the detailed step-by-step instructions I used to update the code to resolve the issue on a Windows operating system:
Download fossil and extract fossil.exe to your <working> directory
Open a normal command prompt
Run cd <working>
Run fossil clone https://system.data.sqlite.org/ sds.fossil
Run fossil open sds.fossil
Run fossil update <release-tag>
For example, fossil update release-1.0.105.2
Update .\System.Data.SQLite.Linq\SQL Generation\SqlGenerator.cs:
a. un-comment lines 1978 - 1983
b. replace line 1982 with the following line:
aggregateResult.Append("COUNT");
Run cd Setup
Run set_YYYY.bat
For example, to build the net451 binaries, run set_2013.bat
Run build.bat ReleaseManagedOnly
Remove the references to System.Data.SQLite.Linq and System.Data.SQLite.EF6 from the ASP.NET Web project
Add references to the new System.Data.SQLite.Linq.dll and System.Data.SQLite.EF6.dll from <working>\bin\2013\Release\bin in the ASP.NET Web project
Sources:
System.Data.SQLite Source Code
System.Data.SQLite Build Procedures
System.Data.SQLite Ticket UUID 76c2eaadc0297696b2c5fb10d41a22325f56f9b9
I have an asp.net / C# web application running in a Windows environment.
The project builds fine and runs perfectly on my local machine's VB.net development server.
However, when I publish to the real application server I receive the following error message:
[OracleException (0x80004005): The provider is not compatible with the version of Oracle client]
[TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.]
There is a version of this application currently up and running just fine, I am testing on the live server in a different directory. I even tried snagging the Oracle.DataAccess .dll from the working application but still get the same error message.
First off: The Oracle client/provider is a mess. And that goes for both the MS one (depreciated anyway) as well as the Oracle one.
In order to connect to an Oracle DB via the ODP.NET provider three things need to be setup properly:
Oracle client needs to be setup properly ( has nothing to do with the .NET provider, this referring to the installed oracle client usually in c:\oracle)
The ODP.NET provider needs to be compatible with the installed Oracle client
The architecture of client and provider and your application need to match, you cannot use the 64bit client with an x86 provider/application and vise versa
Usually the best is to have the newest version of both. But if you want to get rid of this issue once and for all use a third party oracle .NET provider.
UPDATE
One of the better ones is from DataDirect (no affiliation):
http://www.datadirect.com/products/net/net-for-oracle/index.html
It's not just installation (no oracle client necessary), but it's also faster, fully managed, x64 and general support is a way better than what you get with the ODP.NET one. It will cost you though.
The DevArt one is pretty decent as well (and much much cheaper):
http://www.devart.com/dotconnect/oracle/
We decided for the DataDirect for extensibility reasons, this should not be relevant to you however.
Here you can find a good compilation of third parties that build .NET providers, not limited to oracle though:
http://msdn.microsoft.com/en-us/data/dd363565
I came across the same scenario before
Reading this may help you some how ODAC Oracle for .NET
about your problem in your server you have to install the whole ODAC Client from oracle
the latest version now is 4.xx
i have installed it and everything works like charm
hope this helps :)
Take Care
I was able to solve this by searching for Oracle.DataAccess.dll on the prod server.
So instead of trying to build/deploy the project with the Oracle.DataAccess.dll from my development environment, I copied the .dll down from the prod server oracle client directory and included that as a reference instead. I also set the .dll properties "Copy Local = true" and "Specific Version" = true. So it looks like there is a mismatch between the oracle client version on my dev server and the prod server.
Equals, with Oracle.DataAccess.dll Works!!!!
//using Oracle.DataAccess.Client
object pdf = null;
var queryString =#"SELECT PDF FROM DIGITAL WHERE ID_DIGITAL=1001" ; //example
var ctx = new Entities();
var entityConn = ctx.Connection as EntityConnection;
if (entityConn != null)
{
var dbConn = entityConn.StoreConnection as OracleConnection;
dbConn.Open();
var cmd = new OracleCommand(queryString, dbConn);
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
pdf = reader[0];
}
}
dbConn.Close();
}
return pdf;
In addition to the other suggestions, just try running Visual Studio as administrator.
I spent a lot of time messing around with the GAC and various versions of the Oracle.DataAccess.dll, and in the end just running VS as administrator got it to run.
I have a SSIS package which reads an Excel File (Data Flow Source) and transfer the data to SQL Server using OLEDB Destination Data Flow Item.This package is executed by .Net Application using the SSIS Object model. The package stored in a file system within the application subfolder.
The package works fine on my development/test machine both.Both these machine has win2k3 32bit. The SSIS was build in BIDS 32bit Environment.
When I deploye this application on production machine which has win2k3 x64 standard edition i get the error
An OLE DB error has occurred. Error code: 0x80040154. An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered".
The AcquireConnection method call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.
component "Excel Source" (630) failed validation and returned error code 0xC020801C.
I have read in other posts that setting the Run64BitRuntime property of the project(during design time) solves the problem when running it from the BIDS.
How do i set this property through SSIS object model.
Here is the part of the code that executes the package
_application = New Application()
_package = New Package()
_package = _application.LoadPackage(packageName, Nothing)
_updateResult = _package.Execute()
Thanks
Masood
The Run64BitRuntime property only applies to the packaged running inside of BIDS. There is no need to set this property when running outside of BIDS.
I believe that you issue is that when running in code, the package is executing in 64 bit mode, however, Excel does not support this. In order to make this work you will need to shell out to launch the 32-bit version of DTExec.