.NET report getting data from both MSSQL and Oracle - c#

We are using SQL Server 2016 and Oracle 11g (in the process of upgrading to Oracle 12c) .
I'm not a .NET developer; therefore, examples will be very helpful.
Our developers are trying to combine data from both MSSSQL (in-house applications) and Oracle (ERP systems) to create a report in .NET (so just reading from both databases).
The developers are adamant they need to install Oracle client on the server hosting MSSQL.
From the security perspective (surface area exposure), we are encouraged to minimize surface area exposure as much as possible. And I found a possible way on this blog. And this blog that seems to suggest creating a function as connection string.
Questions:
Is there not an option in .NET (array, etc) to hold data from either MSSQL and / or Oracle in memory for comparison (using employee id) with another database?
Since it's only a read, is it an overkill to have full Oracle client installed on the server?
How are the experts here if you need to pull data from both DBs?
Thank you.

At some point a machine will have to have the Oracle client. I don't know of a way to connect to Oracle without it.
I can think of two ways to do this. You can link Oracle tables directly in SQLServer. I presume you can then use the SQLServer dialect to query the Oracle table. I'm sure there is a performance penalty for this, especially if joining across RDBMSes.
A second option is to have some sort of table on your SQLServer that has a copy of the Oracle data. Depending on how much data there is or whether or not you retain it, it could be faster than querying the linked table with a join. It could be a permanent table or a temp table. You'll still need to query the Oracle machine and this done as needed or on a schedule.
If you have very little data, you may not even need a table.
You could also have another machine that performs the query of the Oracle DB and moves the data to SQLServer. You wouldn't need the Oracle client on your SQLServer, but on that machine.

I'd look into building a windows service running on a different server from MSSQL server that would utilize the managed Oracle client to ETL data from Oracle to MSSQL server on a schedule which would allow your .NET report to access the report data from one location, your MSSQL server.

Related

.NET Embedded/Offline DB that works with EF

I've been researching different solutions for an offline database.
Basically I have a desktop application and I would like it to communicate with a database, without requiring internet connection. So I am looking for a way to ship my app along with a database that the app can work with.
All my DB intercation will happen through Entity Framework, so I need a solution that is compatible with it. So far, I have always used SQL Server Express for my DB, but as far as I know that requires that SQL Server is installed on the user's machine, which is obviously not what I need.
My DB will not need to handle huge amounts of data. (Worst-case would be something around 100,000 - 1,000,000 rows of data in the DB).
From what I am reading I found that SQLite, and SQL Server CE and a feature of SQL Server called LocalDB might do the job for me. (SQL Server CE is no longer supported my Microsoft, so I am guessing its not a good idea)
I was wondering if I am on the right track here? Is this the way to go, or is there a way to embed my SQL Server Express into my app.
SQL Server Compact and SQLite can both run as embedded and work with EF (SQL Ce much better than SQLite)
LocalDB might also be an option, requires admin access to install (not during runtime)

C# Sql-server on every client

I want to build an application that needs a sql database on every machine that uses the application.
Isn't it true that Chrome and Firefox store cookies in a SQL database? I did not remember installing anything like a SQL server while installing Chrome, so my question is: does every user has to install a SQL Server if my app uses one?
The best thing for your purpose is to use database servers, which will be started with your application, like SQLite or Sql Server Compact. That means, you application host the database it self and you have access over ADO.Net. This is a very smart kind of storing local data and very easy.
Do not try to install complex database systems like mssql, sybase or mysql on every client.
For example, SQLite can be delivered with a few assemblies in your product.
This answers gives a nice overview: Lightweight SQL database which doesn't require installation
In order to store information for a client application, you can use SQL Server Compact, or some other solution, like SQLite (with a library to access it).
There are other alternatives, but these two are the most common and stable.
It's true that Firefox stores cookies in a sqlite database. However, that's not the same thing as SQL Server.
If your app needs to communicate with a database, you can a) bundle a sqlite database with it, b) require an existing database on startup (Wordpress does this; you can pass it details for a mysql database to get it to use an existing installation), or c) bundle a full database (like SQL Server Compact) with your application.

MsSql server 2008 r2 Data Syncronization

I'm working on a project in C#.NET (WPF) with 2 SQL Server 2008 R2 databases. I need to update new/changed data from local db to online db. Client system has low bandwidth connection. So I need a solution to upload a file to sync.
Can anyone tell me how I can do this? Programming example will be more beneficial for me.
Learn about the following:
SQL Replication
Supports unidirectional or bidirectional synchronization
SSIS
Lets you define the mappings of the data, as well as transformations, and attach other code to the process easily
Linked-servers
Allows you to query databases and tables on remote servers as though they are part of the local database. Very easy to setup (just call exec sp_addlinkedserver) and once defined uses nothing but plain old SQL
Here is a simple tutorial about how to create a linked server.
After creating linked server, we can query it as follows:
select * from [LinkedServerName].[DatabaseName].[schema].[TableName]
If you need this to occur on a button-click or so, then I'd suggest you use linked servers within a stored procedure--they're the simplest option. SSIS would also be suitable, you'd need to execute the package on the button-click.

Bulk and batching between SQL Server 2008 and SQL Server 2008 Express without stored procedures

I want to use MS Sync Framework v2.1 to sync from a SQL Server 2008 to a SQL Server 2008 Express client. The server could have up to a few hundred thousand new rows while the client is turned off. Because of the large number of possible rows, I want to implement batching and bulk imports.
Does anyone have ideas how to handle this situation of syncing down an unknown (a couple rows to a large amount of rows) from the server to the client?
One requirement that makes this harder is that the server cannot have stored procedures running on it, so I think that prohibits use of SyncOrchestrator/SqlSyncProvider unless the client can use the SqlSyncProvider and the server use another provider which does not require stored procedures?
I tried this approach, using SyncOrchestrator/SqlSyncProvider for the Local provider, and the DbServerProvider for the RemoteProvider but received an InvalidCastException. Is this possible?
Are there better options considering the restraint of not using stored procedures on the server?
the DBServerProvider is an older provider that works differently. you used it with SyncAgent/SqlCeClientSyncProvider/DbServerSyncProvider combo. these providers are "anchor-based".
SyncOrchestrator/SqlSyncProvider/SqlCeSyncProvider combo is the newer one and is "knowledge-based".
the older DbServerProvider OOTB supports only SQL Compact for the client database. there used to be a SQLExpressClientSyncProvider but MS has already pulled it out from the download site.
there are ways to get away with not using stored procedures for the SqlSyncProvider by building the SQLCommands yourself in code. you would still need the triggers and tracking tables to track the changes though.

Database access on other machine

I'm working on a program that will work very nicely with a database structure and using mysql. I could easy do this with a common server and common database. However I'm looking for a way to have my client(s) use the program on an offline machine without having to install any database managing software.
Basically I want the installation to set up the necessary tables on their machine and have them fill in the database with information relevant to them. Before I start though I wanted to know if this was possible to connect to and manage a database through a C# application with out installing sql software.
You could consider using SQL Server Compact Edition.
SQLite is another option.
Both of these can be deployed with your application and need no separate configuration.
Yes. It is possible. How to do it exactly depends on the database connection approach you're using. For example, this approach shows how to use DataReaders. That's a very old approach. Modern approaches are recommended to use LINQ to SQL, which can be configured to access remotely by setting up a DataContext to point to an external resource.
Basically, wherever you can define a connection string to connect to a DB, you can make that string point locally or externally. An external resource must obviously be available through some URL in order to connect, of course.
You can not connect to a mysql database without installing mysql.
However you can use in process database like sqlite or Compact SQL. They are not traditional server, but rather a library that keeps the database in a local file.

Categories