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.
Related
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.
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.
I am making C# app that rely on data from one old SQL Server 2005 machine.
Since I have only acces to read only data from that server, I need to build up some kind of handmade replication.
My app is going to use SQL Server 2012 and I am planing to read data from old SQL server in nightly tasks.
Before I start reinventing the well for sync data between two SQL Servers, I'll love to try to find some kind of library or system which can do the JOB.
Unfortunately I can't just setup replication between two SQL Servers because source of data is at SQL Server 2005 version and I do not have admin rights on that server.
I just need few tables to keep sync (updated) at my new SQL Server.
Is there some kind of embedded replication which can be called from code, and which have no needs for writing and admin access to publisher database?
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.
I've started work on a project that requires an SQL Server Database. I will be building a front end application in c# .Net 3.5, that will use LINQ to SQL.
I need to host the database on a network share so that a group of users can all gain access to the database, mainly for read only.
I know that SQL Server Compact is designed to run on the local machine and my company is not willing to front the costs of a full blooded SQL Server.
Is there a way of achieving what I need to do via SQL Server Express?
If so, which are the best guides on how to set this up?
Thanks
If you go with the (free) SQL Server express, it will do what you need - but you don't access it thru a network shared drive - the server would be located by an ip address (or equivalent DNS).
You c# application would be talking to a service - SQL Server - not reading to/from a database file. The service will handle the interaction with the database. Only the SQL Server service will need to know where the file actually is - your client machines won't know and shouldn't care.
If your background is only with file-based databases - i.e. MS Access, you need to change your mindset a bit about how SQL server works.
You can install a SQL Server Express instance and install the SQL Management Studio Express for all users who need access to the database. The Express Edition is a standard SQL server with limitations regarding the number of processors used, the maximum amount of memory used and the maximum database size. If these limitations don't bother you, it should work fine for you.
Using a network share as a database storage to access db files from several clients is a bad idea, as the sql server instance should always be the only one directly accessing the database, both for read and write access. Configuring several instances of SQL Server to access the same database will probably not work - and if it works, it will probably create havoc in your database files.