I am looking into using the new SQL Server Express LocalDB (I think it is code named "Denali") for a desktop application.
It is currently running with SQL Compact, but the user is wanting to share the database between multiple PCs on a network. Unfortunately this is not something that SQL Compact can do, so I am investigating other solutions.
The client requires the ability to send database files easily to other sites or to back them up to a flash disk, so I am avoiding going to SQL Express because there is quite a bit of "administrator" knowledge required to backup and restore.
So, my questions is, does the new SQL Express LocalDB support remote connections to the database over a network and/or through a shared network folder with the mdf file in it?
LocalDB does support supplying a path for an attached local DB in it's connect string (AttachDbFileName) hence the shared network folder option.
NOTE: This question pertains to "LocalDB" the new version of SQL Express 'Denali' and not to SQL Server Express 2008 or prior.
See article here announcing LocalDB's release: http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx
No, SQL Server Express LocalDB doesn't accept remote connections.
The idea with shared network folder might work, but only if you are able to make sure the LocalDB instance is shutdown before you try to copy the file. Also keep in mind that only one LocalDB instance can have any given database file open at the same time. and don't forget about the log files!
Additional security warning: unlike SQL Server Compact databases, SQL Server Express databases (including LocalDB ones) are not designed as secure data exchange format. For instance, they can contain malicious code in .NET assemblies embedded in them. So you should never open databases from untrusted source.
Maybe providing the customer with a simple tool that automates the backup process would be a better idea?
This isn't a fresh thread, but I would like to share my experience with SQL Server Express database LocalDB.
I have a WPF C# project using SQL database with LocalDb Engine. It is working fine no problem, I can use the database with the WPF app. I wanted this app to work on network with more PCs.
On the network another PC can use the database from my PC using UNC path in the connection string.
It seemed to me the remote connection is working. However when the remote PC is connected, I am not able to use the database with my local WPF app. If I run my app first the remote PC could not connect. So this tells me that the remote connection is working, but the multiple connection is not allowed.
OK, I didn't give up and I run the app from my PC twice and I saw it is working which tells me that the same SQL LocalDB engine can handle multiple connections locally only.
I hope this experience will help someone. Thanks.
In short, yes it can. Here is a tutorial on how to configure it.
Also, here is another post with a potential issue that might occur.
Both explain how to configure SQL Server Express to accept Remote Connections.
Related
I am going to build a small application and like to use SQL Server LocalDB, but I'm confused about some points
When I start my instance and shared it in main PC and connecting to my database, does anyone on my local network can see this instance?
if yes, so he can connect to it?
if yes, what is if I closed my application, does the instance still run until he going to end work?
if no way to solve this way
I think to work LocalDB instance until face case to work multiple user in network to switch this database from LocalDB to normal Express edition and work with it as normal.
So can I use the *.mdf, *.ldf files of LocalDB in SQL Server Express edition any time?
When I start my instance and shared it in main PC and connecting to my database, does anyone on my local network can see this instance?
No - LocalDB is a local machine ONLY affair - only from your own local machine can you see and connect to that instance.
So can I use the *.mdf, *.ldf files of LocalDB in SQL Server Express edition any time?
Yes, absolutely - those .mdf (and .ndf and .ldf) files are compatible between LocalDB (which is really just a variant of SQL Server Express) and any other full-fledged SQL Server version (Express, Web, Standard, Developer, Enterprise) - just not with SQL Server Compact - that's a totally separate world with .sdf files.
I am looking to create a database server that can be used to store data using a VB.net application. When I initially installed SQL Server 2005 Express edition, I believe I installed this using the LocalDB option.
As it stands my application is a simple tool which utilises the Process.Start command under certain situations, depending on user input, to launch Game Servers for use at a gaming LAN I assist in running.
I wish to progress the application by being able to update, delete and query a database created in SQL Server 2005 Express. I understand the use of connection strings etc, however I am wondering if the installation using LocalDB will mean that I cannot connect to the server to process the data I require.
Can I continue to use the LocalDB option and create a Database Server for specific use using my application or is a different installation option required?
Secondly, can someone point me in the right direction of how to create a new Server for this purpose? All of my searches so far have provided results for creating a database only, and not the server.
I have a couple questions about what you are trying to do.
First, why are you installing SQL Server 2005? It was released almost a decade ago.
I would go with 2012 express edition.
http://www.microsoft.com/en-us/download/details.aspx?id=29062
Second, install the management tools. SSMS is a nice GUI to do work in.
Third, If you are spinning up anything other than express, there are licensing costs which are quite high. 9K for standard and 25K for enterprise per socket or such.
Here are the versions and features list from microsoft.
http://technet.microsoft.com/en-us/library/ms144275.aspx
Last but not least, having the express edition on another computer is fine. However, you will have to use a network protocol such as TCP/IP instead of shared memory.
It will take longer to send Tabular Data Stream (TDS) to the other computer versus talking to memory on the same computer.
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/c4f06669-41fd-42e6-b4a9-564cf04ca9f7/how-to-choose-between-shared-memory-named-pipes-tcpip-via?forum=sqlgetstarted
Good luck with your project.
You can use a local instance of SQL Server just fine, if you want to set up a separate server for some reason then you'll need either a 2nd machine on which to install SQL Server, or to spin up a virtual machine. If running Windows 8 (and barring hardware limitations) you have Hyper-V at your fingertips.
This is not a complete answer for you but may give you some things to think about.
First you might want to think about your choice of database. If you don't have a compelling reason for using 2005 you will probably at least want to move to SQL Express 2008.
Second, to answer the part about creating a server... A server is something that serves data. In a general sense a computer configured to be contacted by external machines and respond with data is a server. A web server runs a program like IIS or Apache to respond with web pages. A database server contains a database and allows connections to that database. So as long as you install the database on a computer and configure it to allow external connections, you have your database server.
In MS SQL there are several things that need to be set up to allow a database to accept external connections. One is that the SQL Server Browser service will need to be active. Another is that the database itself will need to be configured to allow external connections (SQL Authentication type probably).
Hope this helps.
Addition:
SQL Remote Connection Configuration
Disclaimer, I don't have SQL Express 2005 installed but I think the settings are found in the same place in 2008. If the info here is not exact to SQL Express 2005, the general terminology used here should be enough to get you headed in the right direction to find the specifics.
While viewing the database in Server Management Studio or Enterprise Manager, right click the database server instance name (the root of the tree) and select properties. There should be a section title Connections and within this section there should be an option "Allow remote connections to this server". Make sure it is checked. The other setting you need in this properties menu is under the security area. There is a radio button for "Windows Authentication Mode" and "SQL Server and Windows Authentication Mode", you want the second that allows both.
The next step you have may be to create a new user, add a password, and connect the user to the database. That will give you the credentials you will use in your database connection string while programming. I usually add new users through the security section of the database then set the User Roles for each database that I need to connect to. It is good practice to limit the permissions to those needed by the application. Typically this is read and write, but sometimes you can get away with just read. The less the better.
I want to share my SQL Server 2008 R2 database between some computers on the same network without using a Server. How can I do so? I mean i just want two users access the same Database through A network or LAN. Both can use database,update database,delete data from database
is it possible ?
The file: mdf MS SQL can not be shared directly.
Although, once installed MS SQL any user with privileges on the database can access it.
It is not necessary to share the MDF file. MS SQL is responsible "sharing" the users enter data accessing it.
Greetings.
SQL Server can only be installed on a Windows Server system (except for the Developer's edition, and SQL Express).
However, all versions (except CE) can be shared among multiple clients. Just start up the server, make sure that the TCP protocol is enabled (using the SQL Server Configuration Tool), and that your Windows Firewall is not blocking port 1433.
A server just happens to be a term used for otherwise a "normal" computer. The designation server usually means that it is dedicated for a certain task. Technically speaking, any computer can be a server--even your own workstation while you are using it for other tasks. So, just put the database on one of the user computers which is on the network (hence accessible to desired users on the network) and go for it.... Good luck!
I'm currently working on a project that requires connection to a SQL Server 2008 database over a LAN network. I intend using one computer as a server where the database will be on, while the others will connect to the server. I've done a thorough search but couldn't find any material on this. All the examples and materials I've seen seem to skip the topic of database connection over a LAN. Does anyone know how I can do this? I would like to see a simple code showing how this is done (in VB.net since that's the language that I'm using).
Connecting to SQL Server over the network is no different to connecting to SQL Server on your local machine. Simply...
Using Conn As New SqlConnection(connstring)
//Do something here
End Using
For information about your connection string have a look at connectionstrings.com
There are a few gotchas though that have more to do with networking and firewalls than any code you will have to write so before you start make sure you can connect to your server with SQL Server Management Studio or similar. Make sure you SQL Server is configured to allow incoming connections.
Depending on the nature of your application and the number of users this may not be the best archictecture. Make sure you are using windows authentication as you really don't want to be storing SQL Connection Strings with username and passwords in config files on the client machines.
I'm working on a web service project, and I'm coding at home, where I have SQL Express 2008 installed, but the app needs to interface with an SQL Server Standard. I've never done the transition before, and I haven't been able to find any resources on the subject - plenty of stuff about upgrading, but nothing about how to deploy.
For instance, Visual C# Express, I don't seem to be able to connect to a database without a database file - is that how Standard works as well? Do I just deploy the file with the application?
You can use the Express version also as a stand-alone installation. See here for example. In fact, there is also a free edition of Management Studio. You can manage your database the same way as any other edition. If you install SQL server express in this way, you can move to another version of SQL server without a hitch!
Unless you are doing something very very unusual or something hacky, the deployment will be very easy. Anything that I know of that you can do in the Express version works exactly the same in the full version.
All different ways of connecting to the database are available in both the Express version and full version. You don't need any database file to make a connection, unless the framework that you use requires it. You always connect to the database server through the network, never through the file system.
When you deploy the application you just change the connection string so that it points to the live server. If the login is set up the same way on that server, it works without any other changes.
I think you'll have to manually create the connection string as the IDE won't automatically generate ones connecting to SQL Server Standard Edition. But you can easily record two in the app - one for testing that points to the EXPRESS instance, and one for the live that points to the real one. As long as you're connecting to the same objects and interacting with them in the same way, it should be fine.
You can manually amend your connection string AFTER the IDE has generated its own to something like :
Data Source=ServerName;Initial Catalog=AppDatabase;Integrated Security=True;Persist Security Info=True;Connect Timeout=30
replacing ServerName and AppDatabase as required, and with possible authentication changes. You'll have to watch for the IDE recreating the original connection string, though, as I can't see a way to modify the connection string used in the Database Explorer and if you use the IDE to drag datasources into your app it'll keep using the original connection string.
SQL Server Developer Editions are pretty cheap, though - easily less than £50.