SQL Server VDI Backup - c#

My application should do backup of SQL Server 2008 R2 data. It works fine when app is on server. When I get app to client PC and connect to Server, server cannot find path...
So I decide to use VDI for Backup, find this page http://www.codeproject.com/Articles/19449/Accessing-the-SQL-Server-Virtual-Device-Interface and after some changes, it works fine on local PC. But when I try to backup on server-client. I cant make VirtualDevice on server.
It looks like I need to set VDI server address to create VirtualDevice on server. After that I will be able to use stream to server.
Does anyone have solution? That c++ code is strange to me.
Or if there is another possibility how to make C# app backup database on remote server without using sharedFolder?
Thanks, Jakub

No matter where your drive is or what your drive is [Virtual/Physical] where you want to take a backup. As long as it is shared you will be able to take a backup there.
Say you have a ClientPC and You have shared a folder P:\Backup. Now when taking backup you will use the UNC path something like this....
BACKUP DATABASE [Test_DB]
TO DISK = N'\\ClientPC\Backup\BackupFile.bak'

This question is about VDI (virtual device interface) which is a way to stream the backups to his software - i.e. it won't use a network share nor a local file - it will stream to his code instead.
I do know you need to be in the sysadmin role to run VDI, however I'm not sure of more information about the exact requirements - I was curious about if something could be done via VDI and ran across this post in researching it.
Good luck..

Related

Access to Access Database is Denied when connecting from one pc to another in Network

I have a network with a server and many computers connected to it. I have a software installed on the server which is accessed and used by many clients.
Now i have created a reporting tool using c#/Winforms. In summary it connects to Access DB and creates reports. And each pc on the network contains an Access DB , so we give path to that DB and it creates report for that pc we connect using path like:
\WinPc\Tmuser\Database\users.mdb
When WinPc is the computer name , Tmuser is the shared folder on the pc which contains the database. This works perfectly fine when i have the application (c#/Winform) on the man server it can connect to any pc and generate reports.
But when i put the tool on any pc and give path of Db on another pc it gives error as below:
And i cannot figure out why this error shows up , as when i check the path in explorer it opens the access Db just fine. Kindly let me know if you have any suggestions.
The issue was the permissions, the pc it was connecting too needed credentials when from another pc, instead of server so it did not let it open files... Changing the current user to domain account worked
as the error says, the database is exclusively open by another user.
what i would suggest, because you have a lot of PCs that may try to access the DB is to make a server-client project so every client send requests to write a line to the main server, and the server side in the main server will take those requests and write them to the DB, that way only one computer will write to DB and no one will lock the DB
also, i may not seeing your code, but i'm guessing you forgot to release the DB at some point. always use Using statement when using streams or Connections

Accessing a database on a mapped drive in c#

I have built a SQL database program that holds part numbers and details about them. Right now the program works locally on my machine. However, what I need to do is have the program access the database on a network drive (eg. the L:\ drive). This way, a user can have their own copy of the program, but all the data that is sent and received is done to that common networked database. I have been playing around and also searching online, but cannot seem to find anything, and I am a database beginner. Any help would be much appreciated. Thanks.
What you want to do is install a sql server instance somewhere on your network. Then use a connection string rather than a drive location to access the data.
This is the standard way to share data across applications.
THe problem with this approach is locking and multiuser support to put it simply. You will run into users contending for access to the file . You need a DB server ( SQL Server , Sql Server Express, MySQL , etc etc) to handle this problem for you . The DB server can running on that network server .

SQL server and c# applications over network

I created a C# application that uses .mdf database and it works perfectly on my PC.
Now i wanted to install that application on network PCs that can connect to a single database and use that data.
I tried changing the connection string in application with only changing file path, but it doesn't work. How can i use one PC as server and use program as client application that can connect over network. How do i set up SQL server on that PC, and should i do that? How is this done? I couldn't find any tutorial so far...
Could someone help me a bit.
I don't think you should be doing this, this is something that I once looked into myself. I once used a standard base unit for this same purpose and although it worked fine your not really supposed to do it.
You have to ask yourself how important the application is to the business. If its critical then this would be a real bad move for a couple of reasons :-
1) What happens if base unit hosting SQL Server dies? or is switched
off. Your unstuck.
2) You will only be able to schedule backups of the
SQL Server Database on the local hard disk . If the Disk dies then you
will lose everything.
When all is said and done, for the scenario that you are presenting, a MS Access database is probably a cleaner way to go. Access databases, albeit dated, can be hosted on a shared network space and can be accessed by multiple users. ADO.NET is nt too bad and you can still use LINQ with Data Tables etc.
What your looking into doing in your description wont really be fruitful unless your hosting the SQL Server on an Actual Server, as its designed for.
Some people suggest using using SQL Compact, but that itself is designed only to run from a local machine.
Hope this Helps.
#Milan: Go to the SQL Server configuration manager and enable TCP/IP service for SQL Server. As sql server uses TCP/IP for communication.
This link will help you.
http://kristofmattei.be/2010/06/21/enabling-sql-server-2008-r2-access-over-network/

easiest and/or safest way(s) to save a file to a backup server by code and how?

Full edit:
The scenario is that after uploading the file to the server via a secured web service, I'd like to save/create a copy of that file to another server in a LAN or another network.
I'd like to know what possible ways I could use to programmatically copy/create the backup of the file uploaded to the backup server (saving the file to the database would be the last option probably).
Here are a few details:
Files are of different types and sizes mostly text, documents and images that would be around a few KB to a couple of MB's.
Database is SQL Server 2008 R2 and the only way to connect to it is via calls to a secured WCF service.
Servers can be in the same LAN or on separate networks (depends on the client requesting).
The 2nd server is a redundant server and is using the 1st one as it's backup and vice versa.
Took me a while to find this post. Just map the drive to the backup server's shared folder and implement WindowsImpersonationContext.
How to Impersonate a user in managed code?
haven't seen security problems on this and doesn't need to mess with the HTTP/certificates.

Connect to a local MySQL database from a remote computer using phpMyAdmin

I'm a newbie.. So, please forgive me if it's a simple question :)
I'm developing a system to get some specific data and store it to a database using C#. I have almost finished the system.
I'm using a MySql database running locally on my machine. I need this database to be accessed remotely so that my employer can view the data. He told me to create a phpMyAdmin interface for the database, but I don't have experience with this.
I need the solution to be free, please.
Thanks in advance.
phpMyAdmin is free. You just have to download and install it on the machine with MySql. You will also need a WAMP stack (PHP web server hosting, such as the free WampServer package) to execute the phpMyAdmin website, and open the ports in your router to allow viewing the webpage remotely. Also there might be configuration settings in phpMyAdmin to allow remote access, but all these things have been done many times before and you should be able to find lots of help by googling.

Categories

Resources