Cannot connect to database,.Login failed for user - sql-server-2008

Yesterday my database was connected perfectly.
We have installed Windows Server 2008 R2 on our server and the I have added the user to the client PC name SMTECH5 with user jangid
Now my database is not connecting using windows authentication.
only the master database is connecting.
Here's the the error:
Cannot connect to SMTECH5\COLLEGEERP.
Cannot open user default database. Login failed.
Login failed for user 'SMTECH\jangid'. (Microsoft SQL Server, Error: 4064)

If you go to enterprise manager as a different user, go to the security, logins node and select the user - then change the default database to master.
That should sort it.

The reason is because the default database has been removed (look comment on the question).
You have to Open Sql Server Management Studio, connect to the database, then open Security -> Logins-> right click on the account jangid -> Properties: on the bottom of the window you have to change the default database to the available one, or master.

Try this in SQL Server Management Studio.
1: Open 'Connect to Server' popup
2: Select 'Options >>'
3: Change the value in the dropdown 'Connect to database' from <default> to master.

Related

Connection to SQL Server 2008: error 18452

I have a problem with connection to SQL Server 2008.
My problem is all simple user can't connect to SQL Server 2008 but just the admin in subdomain only who can connected.
I test the connection with these steps:
control panel / set up odbc
system DNS / I choose SQL Server
click on the bottom Add
in the Name=test, and the server = I choose SQLSERVER
When I clicked Next bottom I have error 18452.
Connection failed: SQLState: '28000'
SQL Server Error: 18452
[Microsoft][ODBC SQL Server Driver][SQL Server] connection failed.
SQL Server Error: 18452
Login failed for user ". The user is not associated with a trusted SQL
Server connection.
You should create new DSN with changed Authentication Mode from Windows Authentication Mode to SQL Server Authentication. Then specify login and pass for connection. This login should be added on SQL too.
I were trying to do the same, saw a lot of videos trying to accomplish the add of the DSN but this was my solution.
I'm running Windows Server 2016:
I ran the ODBC 64bit -> System DSN tab -> Add button
Then I selected SQL Server, since i had SQL Server Management Studio 17.
I putted a Name and the fact that is really important: Write the SQL Server you know you have connection to on the Server field.
Be sure you had configured the Security on Server authentication for SQL Server and Windows Authentication mode and then write the user you know that have access to that Data Base.
Last step: you click next after putting the info of the user that have acces to the SQL Server and the connection will pass.
Hope this help someone.

SQL server ODBC connection for Active Directory user who doesn't log in to the windows

Do you think it is possible to create a SQL server ODBC Connection for an active directory user who doesn't log in into the windows.
Ideally this type of users will be used in the batch process. So, Another person logs in and creates a batch process and runs it with another user.
Note: I dont want to create a SQL server authentication. Instead would like to use active directory.
Thanks.
You can't save alternate windows authentication credentials into an ODBC connection for SQL Server. You can only save credentials into the ODBC setting if you use SQL Server authentication.
There are other options though.
You can create a windows authentication ODBC connection to SQL server even if the account you create the connection with doesn't have database access. You just have to untick the "Connect to SQL Server to obtain default settings for the additional configuration options" and you can't use the "Test connection" feature. You just have to create the connection on faith.
With that connection, it will only work if your batch process or application is running as a different account to the logged-in user. Services that run as system accounts do this sort of thing. If you create an application that can be run as a service then you can change the account it runs under.
You can also run as another account manually. Using explorer you can [shift] + right-click on an application and choose "Run As different user" and then enter the other account credentials. Then when the process or application uses the ODBC connection, it will be the correct credentials and work.
There's also "ShellRunAs" https://technet.microsoft.com/en-us/sysinternals/shellrunas.aspx

SQL mangement user error

When i am creating users in SQL management studio i create them under the server name and then i create them under the database but when i try to log on using the user name and password i cant. getting erro saying
> TITLE: Connect to Server
Cannot connect to LAPTOP-RED\SQLEXPRESS.
ADDITIONAL INFORMATION:
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
BUTTONS:
OK
And the suggested solution from the help link is:
User Action
Use the SQL Server Surface Area Configuration tool to allow SQL Server
to accept remote connections. For more information about the SQL
Server Surface Area Configuration Tool, see Surface Area Configuration
for Services and Connections.
Which is what you have to do. By default the SQL Express Server isn't configured to allow remote connections.
hi I faced same issue in MicroSoft sql server 2008.
this error occurs while user limit exceeded, as you have set max connection to 1 and if someone is already logged in (or using any webpage which access your server) then it will not allow anyone to access directly or indirectly. to solve this issue simply follow following steps:
stop all web services.
open services.msc using RUN and ****restart sql server** and do not start any service which uses your sql server, so that you will be able to log in using sql server management studio.
now open sql server management studio and click on New Query button.
It will ask for user name and password use your login name and password.
run these scripts one by one sp_configure 'user connections', 0
go
6.reconfigure with override
after this restart your sql server it will show a confirmation message click on OK.
Bingo
It works. please don't forgot to vote ;-)

Cannot create sql server database user correctly

I'm trying to create a user in a SQL Server database with SQL authentication. That's what I did:
Created database named testDb (with default parameters)
ran script
CREATE LOGIN test
WITH PASSWORD = 'test';
USE testDb;
CREATE USER test FOR LOGIN test;
GO
Ensured user test appeared in Databases\testDb\Security (in Management Studio)
Tried to connect to the server with Management Studio using user test
Got 18456 error.
I'm using SQL Server 2008 Developer Edition. The OS is Windows 7 Ultimate. What am I doing wrong?
By default SQL Server logins are disabled.
You need to right click the instance in SSMS object Explorer then from the "Properties" dialogue, Security Tab enable "SQL Server and Windows Authentication mode".
This requires a restart of the SQL Server service to take effect,

how to resolve the error 233 in sql sever 2005 in windows 7

I m creating a new login using sql server authentication.
a new login is created.
when i m tring to login with sql server authentication there is an error
Cannot connect to (SERVER NAME) i.e name\sqlexpress
Additional Information:
"A connection was successfully established with the server, but then an error
occurred during the login process. (provider: Shared Memory Provider,
error: 0 - No process is on the other end of the pipe.) (Microsoft SQL
Server, Error: 223)"
I hv already enabled all the protocols running as administrater. set authentication mode both windows and sql sever authentication
There are a number of reasons this error message appears. Try each of the following to see if it solves the problem:
Restart the SQL Service - sometimes configuration changes require a restart to take effect.
Check that Named Pipes and TCP/IP protocls are enabled from the SQL Server Configuration Manager
Use Surface Area Configuration Manager to ensure that remote connections are allowed if trying to connect from a remote machine.
Ensure your firewall (on the client and the server) is not blocking connections
Ensure the account has a default database defined.
Ensure the account is not disabled - if you have set up the account to enforce password policies then too many failed logins may disabled the account.
Double check that you are using the correct password - even to the extent of reseting it.
Here is the solution of this error which solve this issue i would like to answer here because if anybody find this question than it will also finds its answer and its time not wasted.
Click on Start menu > Programs > Microsoft Sql Server > Configuration Tools
Select Sql Server Surface Area Configuration.
Now click on Surface Area configuration for services and connections
On the left pane of pop up window click on Remote Connections and Select Local and Remote connections radio button.
Select Using both TCP/IP and named pipes radio button.
click on apply and ok.