SQL Server Linked Server connection gets "stuck" randomly - sql-server

I have an Access DB which I connected to a SQL Server 2012 (v11.0.7507) as a linked server using Microsoft Office 12.0 Access Database Engine OLE DB Provider.
The connection is working fine usually but there are 2 automated jobs that push/pull data and update some other data in the Access DB either of which sometimes (not quite often but sometimes) gets "stuck" while connected to the Access DB. The session in SQL Server is visible but cannot be killed - or actually when I try to kill it it gets stuck in KILLED/ROLLBACK status.
No MSACCESS.EXE is open in tasklist, however the Administrative Tools' Open Files section does show the accdb (and the laccdb) files open by the SQL Agent. Unfortunately closing them there does not solve the problem, the accdb and laccdb files are still locked.
The only solution is restarting the SQL Server and then deleting the laccdb file but that is not a very comfortable solution.
I tried searching for similar issue but did not find a solution so far that would work. The main problem is the (seemingly) random nature.
Have you guys experienced something similar? Do you know what could be wrong with this setup?
Many thanks in advance.

The Access OleDb provider has very limited support in unattended applications, and should never be loaded in a long-lived application. See the note on the download site:
The Office System Drivers are only supported under certain scenarios,
including:
Desktop applications which read from and write to various files
formats including Microsoft Office Access, Microsoft Office Excel and
text files.
To transfer data between supported file formats and a
database repository, such as SQL Server. For example, to transfer data
from an Excel workbook into SQL Server using the SQL Server Import and
Export Wizard or SQL Server Integration Services (provided the SSIS
jobs run in the context of a logged-on user with a valid
HKEY_CURRENT_USER registry hive).
Try using a separate short-lived process instead of Linked Server. An SSIS package is a common choice.

Related

What are my options for accessing an SQL Server database through MS Access front-end while offline

I'm currently working on a project proposal which would require moving multiple Access databases into a new MS SQL Server database. The idea is to keep the front end program as MS Access so that the users are familiar with the process of inputting data and creating reports.
However, things get complicated in that the internet in the areas where the survey will be collected has poor connectivity and will be out from time to time. I had thought of a few ways of solving this issue but all of them are cumbersome:
1) Having a PC with a router that stores the SQL Server database in offline mode and the data entry PCs connect to the PC with the offline database through the router. The PC with the SQL Server database can then backup the db on the server when it has an internet connection.
2) Adding the data to MS Access databases that can then be merged with the SQL Server at specified increments (this would probably cause some issues).
We've done option 1 before for similar projects but never for connecting to an SQL Server database in offline mode. However, it seems feasible.
My question is: Does anyone know of a way of using Access as a front end application for SQL Server and being able to update data during times without internet connectivity? The SQL Server database would automatically assign primary keys, so, duplicate unique values shouldn't be an issue while syncing the data.
Thanks for your help. I've been having a hard time finding an answer on Google and syncing to databases is complicated at the best of times. I'm really just looking for a starting point to see if there are easier ways of accomplishing this.
I would run a the free editon of SQL express on all laptops. So the Access database would be the front end to the local edition of SQL express. SQL express can be a subscriber to the "main" sql database. You thus use SQL replication to sync those local editions of SQL server to the master server. Of course the main SQL server can't be the free edition of SQL server. So to publish the database for replication, you can't use the free edition, but those free editions can certainly be used as subscribers.
This approach would eliminate the need to build or write special software for the Access application. You thus do a traditional migration of the access back end (data tables) to sql server, and then simply run the Access application local with sql express installed on each laptop. You then fire off a sync to the main edition of sql server when such laptops are back at the office.
The other possible would be to adopt and use the net sync framework. This would also allow sync, and would eliminate the need to run sql expess on each machine. I think the least amount of effort is to sync the local editions of sql express with the main editon of SQL server running at the office (but that office edition of SQL server can't be a free edition).

How Can I Use A SQL Database Like I Used To Use Access?

I have been supporting a product written in VB6 with an Access database for a long time. In many of the installations a mapped drive was used to allow multiple workstations to run simultaneously. Since it seems Microsoft has broken that recently, I need to re-write everything with a new set of tools.
I plan to use VB.net and I would like to use a SQL database this time for the stability. The problem is that the market I sell to cannot / will not support installing full blown SQL Server and all the complexities of managing it.
What I am not able to find any current info about is whether or not SQL Server Compact still exists, whether or not it can be added to a NON web based project and if it will be easy to deploy and be easy to manage like an Access database was.
When I try to follow the directions to add SQL Server Compact to my project, it isn't available in the Data Source drop down list (there are "Simple by ErikEJ" versions listed but they don't seem to work) I have seen SQL Server Compact talked about with regards to web projects but I am building a locally installed .exe. I can't find ANY current info about what flavors of SQL are available right now to add to a local program running over a peer to peer network.
SQL Server Compact is no longer supported and developed by Microsoft, I suggest that you use SQL Server Express, it allows remote connections (if configured to allow it) and has modest resource requirements. Supports a database up to 10 GB of size.
As suggested, SQL Server CE can still be used but is no longer supported. For file-based databases, Microsoft currently recommend SQLite.
For a multi-user system, SQL Server Express is probably your best bet. It's still server-based though, so the server needs to be installed somewhere. For local databases, you can install on the same machine as the application and attach a data file on demand. For multiple clients, you'll need the server installed on a machine accessible to all and a permanently-attached database.

Why can't I save an SQL database on the server itself?

I'm trying to set up an SQL server for my web-server to send and receive data from. I'm somewhat confused on how the whole SQL server thing works though. I was wondering why I need a separate server for my SQL and my web server. why can't I save an SQL database on the server itself instead and access it the same way one would read and write an XML or JSON file on the server to store data?
You may be getting caught up with server, as in the computer its running on (physical box, virtual machine, might be easier to think of it as the operating system) vs the server, as in web server/sql server which are different software packages.
So the SQL server (software) and the Web server (software) can run on the same server (hardware, essentially).
Depending on your use case its usually best to have the SQL server on a different server (hardware) to your web server so that there is more dedicated resources for their processes, but its not required.
If you are asking why you cant talk to the database file directly, (in the case of MS SQL Server, at least) the server manages its own permissions and manages all the file IO for you. Its a bit more complicated than a JSON file.

How to Password Protect my SQL Server Database?

I want to deploy my SQL Server 2008 Database with application on the client's machine, where i don't want that anybody can open and read or copy my Database Objects (i.e. Tables, SPs, Functions, Views etc.).
I want to protect database with password same like Microsoft Access 2007 When somebody opens it asks Password. Can it be done in SQL Server 2008, if yes how.?
SQL Server is not like Access and doesn't have any file-based password-protection mechanisms (in the "normal" editions like Web, Standard, Enterprise/Developer, Express).
SQL Server is a server-based product - you need to restrict physical access to the server the files are located on, and prevent unauthorized users from accessing the files through the SQL Server mechanisms (like logins and permissions).
If you need something like Access' password-protected files, you need to use SQL Server Compact Edition which is file-based and has a password-protect feature
An alternative approach that you may also wish to consider, that is in addition to deploying an initial secure instance configuration, is the Transparent Data Encryption feature in SQL Server. This way were someone able to access the database data files "outside" of SQL Server, i.e. via the file system, they would not be able to review the data without decrypting the data files.

Exporting SQL Server Databases for offline use

I have a desktop application (C# .NET 3.5) that uses a SQL server for it's database. I have had a request from the client, however, to make it possible to export the database as it stands, and be able to use it on a laptop without connectivity. They understand that updates to the parent server will not be reflected in these offline clients.
Is there a way I can just save the DataSet's to a binary form and write them to a disk and send those files to the offline clients.
There is an entire line of tools and technologies covering this case, namely the Synch Framework. See Synchronizing Databases. See Getting Started: Client and Server Synchronization for a starting example involving a SQL Server Compact Edition file on the client (.SDF file) that is synchronized with a SQL Server central database. Note that the client won't install anything else other than you application, the SQL Server CE is just a few in-process DLLs that you distribute with your app, nothing nearly as complex as a SQL Express edition on the client.
The good news is that Synch Framework no only allows the client to get their own on-the-go snapshot of the database, it actually allows for changes applied while disconnected to be merged back into the central site.
You could either use Compact Edition (aka. SDF files), or you can save the datasets as XML using the built-in method.
Can't you just take a SQL Server level backup and have them install e.g. SQL Server Express on their laptops and restore the database there?
That way you wouldn't have to do anything special in your app at all - just change the connection string to point to the local SQL Server Express instance, and off you go! No mucking around with serialized data sets and stuff......

Resources