SQL Server remote connection problem - c#

I installed SQL Server 2005, and crated one user.
I am able to connect from the same systen, but while connecting from other system on the LAN it showing the error like below
login failed for the user xxxx. The user is not associated with a trusted sql server connection.
I googled the issue but nothing is sorted out for me. Even some posts on StackOverflow, where it mention to use SQL Server and Windows Authentication also didn't help.

Maybe there is an extra step you have to accomplish... Try to enable the TCP/IP trasport on the Configuration in SQL Server Surface Area Configuration.
This link can help you :
Configure MS SQL Server 2005

Try to set SQL Server and Windows authentication mode in server property. Enterprise Manager -> Right click on the server -> Properties -> tab Security -> Authentication: SQL Server and Windows authentication instead Windows Authentication mode

Related

SQL Express Connection Error When Connecting to Database

I've been trying to connect my Visual basic to SQL because this is what we are taught off but when I execute it, it shows this. How do I fix this?
This Windows user needs to be granted access to SQL Server and that specific database. It is usually configured during installation process of SQL Server. You can still do it by opening SSMS and adding this user under Security -> Logins node from Object Explorer panel.
Of course, to be able to do above, you need to connect to your SQL Server Express first. You may need to use another Windows user or a SQL Server user. The latter would be possible only if SQL Server Authentication has been enabled during installation process by choosing Mixed Mode for authentication (Windows + SQL Server).
You need to get full permission in SQL Server.
Open SSMS there is a Security folder then => Logins.
In Logins you will find your PC's username which is connected to Sql service
Right-click on your username => Properties
Check Windows Authentication Mode

Login failed for user ... SQL Server 2008

I have installed SQL Server, pragmatically with security mode : SQL that means installation in mixed mode.
And I can login with SQL Server authentication but unfortunately when I want to login with Windows authentication I get the following error :
Login failed for user
Please help me.
Step 1: work out what windows user you are connecting as. You need to be certain - don't make assumptions.
Step 2: Add the windows user to the SQL Server. Here is one guide on how to do it.
https://msdn.microsoft.com/en-us/library/aa337562.aspx
here's a youtube video. Only take note from 02:13:
https://www.youtube.com/watch?v=EMATHDoIO8M
The way it works is that firstly the windows user needs to be added as a login to the SQL Server.
Then that windows login needs to be given access to a database (by ticking access to a database). Do you see your windows user listed if you open up SQL Server, and go to security/logins?
Buddy do this :- this will solve ua issue
step 1 :- open SQL
step 2 :- Right-click the server, and then click Properties.
step 3 :- On the Security page, under Server authentication, click the SQL Server and Windows Authentication mode option button, and then click OK
step 4 :- In the SQL Server Management Studio dialog box, click OK to restart SQL Server.
It will solve ua issue..

Login failed for user in SQL Server 2008 for Windows application

I have two PC (both have Win7). On PC "A" I have installed Microsoft SQL Server 2008 and developed a Windows application. On PC "A" my application is running well and there is no connectivity issue.
But when I run this application on PC "B" (connected with PC "B" through LAN and able to share any file) it shows error message login failed for user'....'.
I have already make some possible solution but can't solve it.. Need help
My connection string is:
Data Source=WIN7-PC\PRABHAT;Initial Catalog=plproject;User ID= win7-PC\Prabhat;MultipleActiveResultsets=true
Is there any problem?
The SQL Server error log contains addtional information about failed logins. Look there and find the code that maps to the table listed here: https://support.microsoft.com/en-us/kb/555332
One possible issue is that you are running as a machine account that doesn't exist on machine B. You need the Windows identity to flow from one machine to another and this is typically accomplished with a domain service account. If you want it to work from machine B, you need to access it with an account machine B is aware of. Supplying the User ID is typically for SQL Server authentication, not Windows authentication. You could try adding the password and see if that works.
Here is a breakdown of SQL Connection String syntax: https://www.connectionstrings.com/sql-server/
You need to enable TCP/IP for cross machine SQL SERVER access. Just follow below mentioned steps to ensure whether it is enable or disabled.
Click on window start menu.
Navigate to Microsoft SQL SERVER => Configuration Tool => SQL
Server 2008 Configuration Manager.
In Opened window Navigate to SQL SERVER Network Configuration =>
Protocols for <MSSQLSERVER> (Protocols for your SQL server
instance name)
Check Whether TCP/IP is enabled or not.

Unable connect to SQL Server 2008 R2

I have a C# project with SQL Server 2008 R2 and the project runs with no problem on my local machine and when I publish it to the server Win2008 R2. But the project doesn't work and can't connect to the server with no error. All the database setting check and I enabled TCP/IP setting and etc. But still not worked. I think the problem is with connection string that is below.
When pages going to connect to the database, nothing happened in browser and browser stick in loading mode (waiting for respond).
Connection string on my computer
Data Source =(Local);Initial Catalog=Bulk;Integrated Security=True;Timeout=0;Max Pool Size=5000;
Connection string on Windows server
Data Source=My Ip Windows Server,1433;Network Library=DBMSSOCN;Initial Catalog=Bulk;User ID=administrator;Password=My Windows Login Pass;Timeout=0;Max Pool Size=5000;
I got this error:
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 that the instance name is correct and that
SQL Server is configured to allow remote connections. (provider: SQL
Network Interfaces, error: 26 - Error Locating Server/Instance
Specified
In your connection string of Server you have:
Data Source=My Ip Windows Server,1433;Network Library=DBMSSOCN;
To connect via IP Address and Port of 1433 and over TCP/IP protocol
Initial Catalog=Bulk;
Bulk is your database name
User ID=administrator;Password=My Windows Login Pass;
Authenticate via SQL Server connection by administrator login user and its password.
I think your problem is in third part that you want to connect to SQL Server by your Windows user name; You can see valid logins of your SQL Server in Security branch of your registered server in SQL Server Management Studio that will shows your Windows user name like Domain Name\User Name so you need to change User Id to that.
Configure the Windows Firewall to Allow SQL Server Access. open port 1433 in windows firewall.
see this link. Or this.
Please Try to connect in your local Sqlserver With Live Login Detail,
If you are Success Then There should be Permission Need to set From the Live Hosting Server
if is it possible then please add the More specification.
You should log the errors that occur, e.g. in Application_Error if it's actually an ASP.Net project.
Using the log you should get errormessages that hint you or enable you to give more details so nobody has to guess what your actual issue is.
Regarding your issue:
Did you give your Windows account the necessary READ/WRITE access on SQL Server?
On MS SQL Server the account needs access to:
1. Be added to the general Security/Logins for an actual match of Windows account to Login.
2. Be added to the specific database Security/Users tab with the necessary database role membership.
In addition to specifiying your Windows account + password in the connectionstring: maybe it's better to run the application pool using a service-account and use
Integrated Security=True
and remove
User ID=administrator;Password=My Windows Login Pass;
I have changed my connection string to this and problem solved.
public static string ConnectionString = "Data Source=My Ip,1433;Initial Catalog=My DataBase;UID=sa;Pwd=My Pass;Timeout=0;Max Pool Size=5000;";
In sql server management studio
Click "Security" => "Logins" => "sa" right-click and click properties
in the left side click "Status" and in the right side,Choose enable in login

Regarding local network connection string

I need some opinions and ideas on how to choose and use sql connection string? i do search fom sqlconnectionstring's website, but i tried for few types couldn't work with my network system. can pros out there help me please?
My condition is like below:
I got 1 computer for hosting and i installed sql2008 express server(microsoft sql management studio), and login as window authentication. (ip: 192.168.1.101)
With my created database was with out any security login id and password. (.MDF)
I got another computers work as client to connect and access the hosting computer which hosting the sql server. there ip had set to static (192.168.1.102, 192.168.1.103, 192.168.1.104)
i had tested this connection string but i failed to get connect
Data Source=192.168.1.101,1433;Network Library=DBMSSOCN;
Initial Catalog=myDataBase
I did configure the firewall to allow the 1433 ports which is my sqlserver current using port. Checked sqlserver tcp:enabled, via:enabled, Namepipe:enabled, shareMemory:enabled. Setting of allowed computer remote-able.
So far these are what i configured, but still unable to connect, can anybody guide me?
Maybe because you're using a windows authentication. If you're connecting to SQL server using another computer, the login of that computer should be:
A part of a domain where the server is (i.e. [domain]\myusername).
It should be added to the SQL Server's Security\Login. Go to management studio, then in the object explorer under the server, go to the folder Security\Login. You should see a list of users under login. Your user (other computer's login) should be there.
Now, if you're not part of a domain, you should use a SQL server authentication. I haven't tried using windows authentication in two computers which is not part of a domain.

Categories

Resources