Cannot access Azure SQL database - sql

I am having trouble accessing my Azure SQL database. I Have whitelisted my ip address(using 'what is my ip' in google to find it) The connection string in the azure portal is -
Driver={SQL Server Native Client
10.0};Server=tcp:nrmuolxpqg.database.windows.net,1433;Database=databasename;Uid=username#nrmuolxpqg;Pwd={your_password_here};Encrypt=yes;Connection
Timeout=30;
What do I put into the Migration Tool, or into visual studio as the connection properties? In particular what to do with the 'tcp' at the starte of the server string?
The fields I need to fill in are:
-Server name (do I need to put tcp or the port number in here? )
-Login
-password - (this is my windows account password right? )
-Database

The only thing you need to change is the username and password. This is something you specified when you created the server. It's not the same as your Windows username and password.
If you forgot the password, you can reset following these instructions, Password reset for Azure database.
EDIT 06/20/2018 - Finding the username
If you forgot your username, you can find it by clicking the Show database connection strings link in the Essentials window.
The ADO.NET connection string will not show the username but any of the other examples will.
Here are a few additional things you can try to resolve connection issues.
Try pinging the server. The server doesn't respond to the request but the name should be resolved to an IP address.
Verify that your client IP address has been added as a firewall rule.
Make sure you are using the correct connection string (in your question you are using the ODBC connection string, you might want to try the ADO.NET one). Also double-check that you use the correct username and password.
To connect from Visual Studio, add a connection from the Server Explorer window using the server name and login info as shown below. Obviously you have to change the server name and login info to match you specifics. I'm connecting to a database called StackDemo in the below screenshot.
If you still can't connect, there might be an issue where your company's or personal firewall is blocking the connection.

Related

[Microsoft][ODBC Driver Manager] Can't establish connection to SQL server

Very new to this so I do apologize.
My client sent me a .accdb file, .dsn, and .txt containing the username and password.
My assumption is that I need to start the ODBC Administer (64 bit), then add DSN file, and then input the username, password values when setting the connection up. However when I do that, my error says that the database does not exist OR my credentials are wrong.
Am I approaching the connection path completely wrong? Help steer me towards the right direction.
The database does not exist error implies that the the server is not reachable based on the settings entered. This can happen if the database is behind a firewall and perhaps you need a VPN connect or the server name / database name are not correct. In the DSN, you should have the server name, IP address or domain name. You can try pinging the server name from a command prompt to see if you have connectivity to it. Is the database hosted on the clients network or hosted on the Internet i.e. godaddy.com or another web hosting provider?

Connect to Sql Server 2014 database into Azure VM

I just created a new SQL Server 2014 VM from Windows Azure gallery. I did remote login into VM , on trying to login into DB with Windows Authentication mode, I get below error:
Login failed for user 'dbserver\dba1'. (.Net SqlClient Data Provider)
Are there any specific steps, which I have to follow for new SQL Server DB login to work properly?
P.S. I have opened port 1433 into windows firewall, it did not help, althoug that should not be required for logging in directly from VM.
I guess Azure VM is not joined to domain. This means that only SQL authentication will work against this SQL Server instance. You might need to do the following:
Enable Mixed authentication on the SQL Server
Add a user mapped to SA role (or enable SA and set its password, but having separate user is better)
Open port 1433 (you did this already)
Make sure SQL is listening on this port (should be already)
In case you connecting outside of the same Azure Cloud Service - make sure you have endpoint created for the VM. Highly recommended to use port different from 1433 as the endpoint public port.
Don't forget to specify port if it is not standard, SQL connection string expects comma for it (i.e. myvmpublicname.cloudapp.net,12345)
You can check this article for more details
I was getting connection inside the VM using MSSQL Server, but not from outside. After reading some comments, I found that I needed to add a specific port for outgoing traffic and added that port at Azure firewall:
Here are the steps to check is it working for you or not:
Start Sql Server configuration Manager
Click on your Server name
Click SQL Server network config
Click on protocols
Click on TCP/IP
At the end of tcp/IP range set your port, I set 1433.
Please restart SQL Database.
Now open port at Azure management portal. And conntect through SQL tools or other services.
And also remember to open windows firewall.
It most likely installed another windows user as the admin for the SQL Database. If you know what that user is, login as them.
Otherwise, did you manage to set up the SQL in mixed mode and have an sa password. If so, login with that then add the Windows Account.
If not, try Forgot SQL Server Password to reset the sa password and get access that way.

Unable to connect to SQL server using vb.net

I am using Connection string in my web.config. I have given user id, password, data source etc in the connection string. When i tried to connect to the SQL server using "Connection.Open()" I am getting an exception stating The user is not authorized. The user name that is mentioned is my windows user name(yes my windows user name and not the one mentioned in connection string). I am not sure why and how this is happening. I tried several times and the same thing is happening.
If you believe that VB.NET is part of the problem, try using the same connection parameters from the same client, but with different client software. For example try connecting from Access or SQL Server Management Studio or Excel. This will help you narrow down whether your problem is with the security configuration versus the code or client software. Often times if you try to connect from a remote workstation you can end up with a failure against a server that has not been configured to allow remote connections.

CF9 + SQL Server Express

I just created a new database in "Microsoft SQL Server Management Studio Express" and now I'm in "ColdFusion Administrator" and I'm trying to add my database as a Data Source. How do I do that? I believe the servername is .\SQLEXPRESS but I'm not sure what the default username and password are. I've tried creating a new login through Management Studio with an actual username and password, but those aren't working either. The error I'm getting is:
Connection verification failed for data source: xxx
java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]The requested instance is either invalid or not running.
The root cause was that: java.sql.SQLNonTransientConnectionException: [Macromedia][SQLServer JDBC Driver]The requested instance is either invalid or not running.
I can see that the service is running, and I can connect to it through management studio. I've tried following a couple tutorials online, but they don't seem to be working for me. Ideas?
Server name can be any resolvable hostname or domain name, in case of having SQL Server and CF server on same box localhost should work for you.
Also make sure that user you created has access to the particular database and needed operations. Look into the database permissions for this. This check is not required when using master account (often login is sa), but this is not recommended practice because of the security reasons.
Also make sure SQL Server and Windows Authentication mode is checked. I had an issue with permissions as well when I only had Windows Authentication enabled under:
right click on server (localhost) -> security
Then restart SQL Server Services to save changes. After that I was able to connect my ColdFusion datasource to SQL Server.
For testings sake use the same credentials that you are connected with in Management Studio, likely the "sa" user and password. Once you have it working with "sa" then go back into Management Studio and create an application level user for your CF app and then update the data source to use your new user / password.

Using MS Access 2003 to connect to SQL Server 2005

My dad built an MS Access Database to do property management. Now he wants to share it with other users over the internet. So I got a hosted SQL Server account at Network Solutions. Now I'm trying to connect the Access 2003 client to a test SQL database using these guidelines from MS:
http://office.microsoft.com/en-us/access/HP052745861033.aspx
However, the error message I get is "Connection Failed because of an error initializing the provider. Server does not exist or access is denied".
I've run the MSComponentChecker to make sure I have MDAC 2.7 or above. Mine is 2.8 SP1 on XP.
It sounds like either:
(1) your workstation is unable to connect to the SQL server instance because
(a) the hostname isn't resolving correctly
or
(b) a firewall in your network or on your workstation is preventing the outbound connection on the needed port
or
(2) you can connect and have the correct username and password but don't have sufficient privileges to get to the database you're attempting to use. Access gives a different error than what you received if you have a bad username or password ("Login failed for user 'xxxx').
You can check the networking by running "telnet example.com 1433" (whatever hostname and port you were given to use; if you weren't given a port, use 1433) and making sure you can connect (the command window will go to a blank screen). If that works, you can then confirm with your provider that the account you're using has been granted the needed permissions. If you can't telnet to the address you need, check you have the right hostname and the existence of any firewalls.
After a little more research, I figured it out.
In MS Access 2003, you have to enter the server name in this format:
serverName\instanceName,portNumber
This is a BackSlash, not a ForwardSlash. Thank you MS.
Not sure why I had to specify the port number when it's the default.
Special thanks to this post:
http://dbaspot.com/forums/sqlserver-server/251219-error-connecting-remote-server.html
It should be noted that you can't do much design work in Access 2003 once you are connected. So I needed to upgrade to 2007 to change the SQL schema. Hopefully, 2003 users will still be able to connect and use the app.