I am using SQL Server Management Studio 10.5 and I'd like to link an Access file to it. I've been looking for answers over the internet but I didn't find any answers for this version.
I'm stuck at creating a new datasource (which should be the access file, right ?).
Where am I supposed to see the wizard for the creation of the datasource?
Use DB Root tree-> Linked Servers -> Server Objects-> Linked Servers.
Don't forget to create a DSN to access to it from SSMS.
Related
I have created a local db and I want to connect some tables to Microsoft Access. I'm doing this via Microsoft Access's "Link to the data source by creating a linked table" feature" and in order to do that I need to create a DSN. However I'm getting an error where it says
"Server does not exist or access denied"
At the moment I'm trying to create a new DSN and i'm stuck during the below step which I need to specify my server. I've tried two different server names and they both don't work.
Note: It's definitely not an access denied issue because I've tested the login myself and they all work fine.
Can someone please tell me what I'm doing wrong or is it not possible to link Access to a local db.
Resolution
When choosing a driver for the new data source, use either the ODBC Driver...for SQL Server or the SQL Server Native Client. (note: I am also able to get the "SQL Server" driver to work, but only by specifying the named pipe address of the instance in the next step/image where specifying the SQL Server to connect to.)
The SQL Server to connect to in the "Create a New Data Source to SQL Server" should be "(LocalDB)\instancename"; in this case "(LocalDB)\MSSQLLocalDB"
Caveats
As the LocalDB name itself implies, connections to it can only be
made from the local machine. If you need to access an instance on a
different machine, and need a free solution, you should use SQL
Server Express.
These results were obtained using Access 2016. My
experience with other software indicates it should work with Access
2010 as well, but I did not test that. If you have trouble, try using
the named pipe address for the instance instead of the
"(localdb)\MSSQLLocalDB" moniker in the image above.
Results
Here are the results of testing the connection, then adding links to two tables in the master database
Instead of using a LocalDB I used SQLExpress which worked fine.
I am about to begin a personal project to build my skills in the .net environment. I am familiar with SQL Server Management Studio and how to create a database in it but I discovered how to make a local database in Visual Studio as well. My program is only going to require local database access as it will be used for individual inventory systems rather than connected ones. Am I ok to use the onboard tools in visual studio and create a local databasse or should I be using the SQL Server Management Studio?
When you use the Local Database item template in VS, it creates a SQL Server CE data file (SDF) and adds it to your project. When you use the Service-based Database item templete, it creates a SQL Server (Express) data file (MDF) and adds it to your project.
The advantage of using the VS tools is that the data file becomes part of your project and can therefore be easily deployed with the compiled application. As such, the database is basically part of the application.
If you choose SQL Server CE then you don't need a server installed on the user's local machine. They can install SQL Server CE or you can install it with your app if you want, but you also have the option of simply deploying a DLL with your app and it will work.
If you choose SQL Server Express then the user actually needs a SQL Server instance installed on their machine. To be honest, I'm not 100% sure whether that instance must be SQL Server Express or it can be a full SQL Server instance too. It would usually be SQL Server Express though, which you can install and even download automatically when you install your app, depending on the deployment method you choose.
If you use the VS tools to create an MDF data file then your connection string will contain the Data Source and AttachDbFilename attributes. The Data Source will generally be ".\SQLExpress", i.e. an instance named "SQLExpress" on the local machine. That instance name is not required, although it is the default for SQL Server Express, but it must be on the local machine. The MDF file gets attached at run time and detached again when you're app is done with it. It will also usually be attached to a user instance, which means that other users can't see it, even when it's attached. Note that, in later versions, the LocalDB feature of SQL Server may also be utilised.
If you create your database in Management Studio then it's not actually part of your app. It will be permanently attached to the SQL Server instance so, everyone will be able to see it and open it, assuming permissions allow. Creating the database during deployment will be an extra step in that case. You might create a backup and restore that during deployment or generate SQL scripts that get run. In this case, your connection string will contain the Initial Catalog attribute to specify the name of database to connect to, as well as the Data Source attribute. This option is required if you want multiple clients to be able to connect to the database.
In short, if you are only going to be accessing a database from the local instance of the one application then creating a database in VS is OK and probably a good idea. Whether you choose SQL Server CE or SQL Server Express may well depend on what level of functionality you need.
I have written an asp.net mvc application that is connected to a Microsoft SQL Server Management Studio database and I want to deploy the application to the webhosting server now. I have managed to get the published code onto the server easily. However, I want to ftp the database I created in Microsoft SQL Server Management Studio to the server. Where are these created databases saved and is it possible to ftp the database to the server. The other issue is the web hosting server is using MS SQL Server Express is that a problem?
Normally shared hosts expect you to place the database in the App_Data folder and use it directly from there.
Here is a page to explain connecting to the database
http://msdn.microsoft.com/en-us/library/ms247257.aspx
To find the database on your system open sql management studio right click the Database and click Properties on the Properties windows click on the Files section to show all associated files with your database.
I would recommend checking your providers documentaion though they might have specific requirments for database deployments
I'm using VB 2008 Express for our College Project. I'm also running SQL Server 2008 Express and have installed SQL Server Management Studio and used it to create my database.
Both software have been installed and running locally. I'm trying to connect to the database from VB 2008 Express. Database connection wizard have 3 options:
connecting to Access db
connecting to SQL Server 3.5 compact db and
connecting to SQL Server db file.
There are no problems connecting to the first two but when I try to connect to my SQL server DB file (.mdf) it throws the following error ("Unable to open the physical file .... Operating system error 32:(failed to retrieve text for this error. reason:1815.......an attempt to attach an auto-named database for file ...... .mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share")
I appreciate if anyone who had the same experience and overcome the problem could point me in the right direction.
Thanks very much.
Little Critter.
You need to detach your database from the server. Since you created the file there it is already running on the SQL Express server. Operating System Error 32 is a sharing violation and it means that the file is in use.
Try this:
Open Sql Express 2008 Managment Studio and find your database in the Object Explorer tree.
Right click on your database, choose tasks, and then select "Detach"
When the "Detach Database" dialog appears, select the checkbox that says "Drop Connections"
Click ok.
Your database should detach from the database server. Now the server will no longer bring that database up automatically and you should be able to get exclusive access to it.
Note that if you want to make more edits to the MDF you will have to reattach the database or you will need to use the tools built into VB 2008 Express. Because of this most people would choose to leave the database attached and not run it as a "User Instance". Check out this link for alternative ways to get to your data: How to: Access and Initialize Server Explorer/Database Explorer.
Anyway, you may have your reasons for setting it up this way. The steps outlined above should fix you up. Good luck with your project!
This kind'a sucks. If I connect to a SQL Server DB (.mdb file) through VS.Net's server explorer, then I can't connect to the same file via SQL Server 2008 Management Studio at the same file. The file is locked.
For example, I get the following error from SQL Server Management Studio
CREATE FILE encountered operating
system error 32(The process cannot
access the file because it is being
used by another process.) while
attempting to open or create the
physical file 'C:\SQL Server 2000
Sample Databases\NORTHWND.MDF'.
(Microsoft SQL Server, Error: 5123)
I'm playing around with LINQ to SQL. So you would need to connect to VS.Net server explorer to drag in your table objects and create the .dbml files. However, if I want to query the database using old school SQL from management studio, I can't... I get the above error. Ditto if I try to connect using LINQPad (great tool...but useless thanks to this irritating file lock).
So does anyone out there know how I can connect to the same .mdb file from multiple programs like VS.Net's server explorer, SQL Server's management studio and LINQPad all at the same time?
Thanks!
By the way, this site is simply awesome and I love the fact that they made it in ASP.Net and used LINQ to SQL for data access... okay, off topic. Sorry.
The sql engine will lock the file once connected to it. nothing prevents you from attaching a file to an instance of SQL server and then connect to it from multiple applications.
The clue is in the name "SQL Server" - its seems that you can't attach the DB to two places which is not entirely unreasonable because you can't serve it twice (given that the server has responsibilities for things like transactions, logs, locking, etc).
So...
You want to "run" the database in an SQL Server instance and then connect from Visual Studio to that instance and then to the file rather than open the file directly (the option is there because it simplifies some deployment models) at which point you should get what you need.
As an aside, its perfectly possible to to "old school SQL" from within Visual Studio - although I'm not aware of an equivalent to LinqPad