How to connect to a SQL Server from an m1 chip macbook - sql

I am working on a project with a friend and he has deployed a SQL Server database. He uses a PC and can access the database using Microsoft SQL Server Management Studio (SSMS).
However I have a Macbook with an M1 chip and so I cannot use SSMS and need to figure out which SQL Server application I want.
It seems like the way to go is Microsoft Azure Data Studio. I cannot figure out how to connect properly, I have looked at several solutions posted online which all say to download docker, download the latest SQL Server image, use SQL edge, run SQL Server in a container and then open Azure and connect.
One caveat is that all these tutorials end with creating a SQL Server on the local host rather than connecting to an existing one.
In Azure, after entering server id, username and password, there is a green dot on the label of the DB on the left drop down menu, indicating that the connection to the DB was successful. However whenever I try to view the DB's from the drop down it loads and then errors:
Object Explorer task didn't complete within 45 seconds
and I cannot run any basic queries either.
At this point I don't care what IDE I use as long as it works. Any advice is much appreciated. It seems like this task should be super easy but has given me such a hard time and we cannot continue working on the project until I get access.
Anyways, thanks again in advance! and lmk if there's any other info I should provide.
Tried using docker with Azure Data Studio and my results were the same as when I only used Azure.

You'll want to use Azure Data Studio.
You don't need Docker at all to meet your goals. Those tutorials were in regards to running your own SQL Server instance on a Mac. You're trying to connect to an existing instance.
As mentioned in the comments, where is the existing SQL Server instance located?...is it on a server that's part of a domain. Is your Mac part of that same domain? It sounds like you're getting some kind of timeout issue or some sort of authentication issue. So this is more of an infrastructure question.
Once connected to the SQL Server instance in Azure Data Studio, what happens if you just open a blank worksheet and run the query SELECT ##SERVERNAME?

Related

How to allow others to run Web App using LocalDb

I have created this assignment where I am essentially using .net Core to read and write to an instance of a SQL localDb: Github
This is my first time using a localdb, but when I submitted it to my professor, he is not able to create, or manipulate the database at all. My thoughts were that when he runs it, it would create and instance of the database on his computer, but I guess not. He gets the following error:
SqlException: Cannot open database 'Bartender_App' requested by login. The Login failed. Login failed for user "Username"
this error occurs when trying to create a new order. Is there any way to bypass this authentication? because the web app works on my computer.
would he have to create his own migrations and update the database from Visual Studios on his end?
I have tried to look it up, but come across deployment of these web apps to a server which is not what I am trying to do, I am just aiming for him to be able to run the application on his computer, even if the database starts empty, and he can manipulate, add, and remove the data from the localDb instance
I apologize in advance for the tags - the autocomplete feature was not showing up correctly.
Is there any way to bypass this authentication? because the web app
works on my computer.
This is impossible, SQL Server Express LocalDB does not accept remote connections.
As an alternative, you can automate the backup of your database structure and provide it to your instructor, you can refer to How to copy a database from one computer to another?.
If there is not much table, manual creation may be faster and easier.
More details ,have a look for Can SQL Server Express LocalDB be connected to remotely?.

Cannot connect to a MSSQL Express 2014 Database using VS 2013 Professional (specifically VB)

I read another article concerning this problem when getting the file in use message. I went into SQL Management studio and disconnected the database but still no success in connecting. Here's what's happening step by step:
I downloaded SQL Express 2014 and installed it. I created a DB called MyEntertainmentDB, then created a couple of files (Movies and Rating). I added some data to both. I fired up VS and in VB I created a form added various controls including a datagrid. The DB exists in the default location used by MS SQL. I clicked the Smart Tag and the data grid view tasks window appears. I click the choose data source drop down arrow and then add project data source. Database is highlighted and I click next. Dataset is highlighted and I click next. Now I click new connection and select Microsoft SQL Server Database File (Data provider is .NET Framework Data Provider for SQL Server (the only thing in that drop down box)) and I click Continue. Now I'm shown a window that has the data source as Microsoft SQL Server Database File (SqlClient) in the first box and I browse to where my database is located and select it (which is C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\MyEntertainmentDB.mdf). Everything is going well and I'm using Windows Authentication. I click ok. Now it waits several minutes and I get this message:
The attempt to attach to the database failed with the following message: A network related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
I looked in theSQL Server log but nothing was mentioned shedding any light. I could not find any VS log. I checked the windows logs but could not find anything seemingly relevant. I'm at a loss for this problem and am about ready to trash MS SQL server and just go with MS Access 2010 or MySQL. Does anybody see where I'm going wrong? If so, please help, I've tried to be very specific and hope I've provided all info necessary.
First of all you must configure your MSSQL Express Server to respond.
To do that you must open SQL Server Configuration Manager (on Windows 8.1 just go in the upper right corner, hit Search and type: SQL Server Configuration Manager. If you are using Windows 7 you can find it on Start Menu).
On SQL Config Manager you must go to expand SQL Server Network Configuration and you'll see Protocols for (your DB instance). Click on that.
After you click on Protocols for (your DB instance) in the right window you will see Shared Memory, Named Pipes and TCP/IP. Double click on each and set them to Enabled = Yes.
Now your MSSQL Server must listen to standard port 1433. To do this double click on TCP/IP, select IP Addresses (Now you will see IP1 config, IP2 config, etc), scroll down to IPAll and set TCP Dynamic Ports to 0 and TCP Port to 1433.
Now restart your SQL Server Service. If don't know how to this, just reboot your computer. After reboot open command prompt and type netstat -a to see if your MSSQL is listening on port 1433.
Now in Visual Studio when you are connecting to your SQL Server on Server Name type server IP (your IP or 127.0.0.1) or you can select your SQL Server instance from dropdown list without any problems.
You can check this tutorial too: Allow SQL Server Express to accept remote connections
Alright, I finally solved the problem and not in a way people would think. First off, I want to thank everyone who responded with the intelligent answers, but we were off base on this one and I'm not sure why, but your responses ultimately led to my defeating this problem. I've been wrestling with this problem for the last 3 days almost exclusively - I don't like being beaten - and 1 entire night. I've uninstalled and re-installed several times and even got superstitious and waved a chicken bone - lol - at it but nothing worked! I've asked this question on several web sites and finally I went to a link that stated the .msi file was included with MS SQL Server 2012 Management objects I and was hesitant to download as they pertained to the 2012 version. So after tinkering to no avail I downloaded the 2012 CLR Types and Management Objects and looked in the Windows\assemblies folder and still no v 11. But I guess 2012 installation installed them in Program Files (x86)\Microsoft SQL Server\110\SDK\assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll v11.0.2100.60. I ran VS 2013 and added the data source. After going through all this problem I'm wondering why Microsoft invents all these places to put things when one would work. Every version of windows from 3 to present has always been totally revised and I wonder for what. Improvements are okay but quit reinventing the wheel. Without your help I might not have ever found the solution and perhaps would have been an oracle or mysql guru or not. Your the men. Thanks all.
Do not connect to mdf, connect to the SQL Server and use MyEntertainmentDB database from there.
The MDF file is locked by the SQL Server for reading/writing data.

Creating a Database Server for home use in SQL Server 2005 Express

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.

Can SQL Server Express LocalDB be connected to remotely?

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.

Connection failing when I try to process a cube in BIDS

There is probably a simple answer to this question but I do not have much experience with SQL Server/SSAS. I can connect to my local server PCNAME\SQLEXPRESS in SQL Server 2008. On that server I have made a database, some dimension tables, and a fact table that I intend to build a cube from.
I have been following tutorials on the internet on how to build a cube. I can successfully make a data source that connects to PCNAME\SQLEXPRESS, as well as make a data source view from it.
The problem is that after I build the cube, I get A connection cannot be made. Ensure that the server is running. and cannot process the cube. BIDS is displaying the star schema of my tables just fine, recognizes the relationships via foreign keys, etc... so I figured the server was running since it could access all of that data.
Does anyone know why this is happening, and if my server really isn't running can someone tell me how to start it? I am using SQL Server 2008 R2.
Thanks,
Logan
edit: I just tried to change the server name to PCNAME\SQLEXPRESS instead of localhost in the Properties->Deployment option menu. I get A connection cannot be made to redirector. Ensure that 'SQL Browser' is running.
I solved this problem - for people that find this page on Google in the future: when I first installed SQL Server, the SSAS part failed to install. I uninstalled SQL Server and when I reinstalled, I looked deeper into the issue. Apparently one of the services needed to run SSAS has a weird bug where it cannot be started if your Event Log is full. I finished the installation of SQL Server, cleared my Event Log (Administrative Tools -> Event Viewer -> Click Each Log and go to Action -> Clear All Events), and then started the SSAS service in the SQL Configuration Manager.
You can start by going to "Programs->Microsoft SQL Server 2008->Configuration Tools->SQL Server Configuration Manager". Once there, you need to start the services "SQL Server", "SQL Server Analysis Services", and maybe try starting "SQL Server Browser", though I believe that is not necessary.