473,388 Members | 1,207 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Can't Connect to SQL db

Going a bit crazy. Have sqlserver all installed and running. I have a
security problem I think- have read many other news posts that SOUND
similar but e.g. My SQL Server configuration manager doesnt seem to
have seccurity options let alone offer the possibility of allowing a
'mix' of SQL/ windows requests.

For logon in SQL Server configuration manager 'built- in account'
local system is selected rather than the 'this account' option which
has stars in the password field and no username options.

This is myconnection string: kris\ is this local machine

myConnection = New SqlConnection("server=kris
\SQLEXPRESS;uid=sa;pwd=;database=pubs")

This is the error I get
System.Data.SqlClient.SqlException was unhandled
Class=14
ErrorCode=-2146232060
LineNumber=65536
Message="Login failed for user 'sa'. The user is not associated with
a trusted SQL Server connection."
Number=18452
Procedure=""
Server="kris\SQLEXPRESS"

Any ideas?

Feb 13 '07 #1
4 9388
DanWeaver (da*********@googlemail.com) writes:
This is myconnection string: kris\ is this local machine

myConnection = New SqlConnection("server=kris
\SQLEXPRESS;uid=sa;pwd=;database=pubs")

This is the error I get
System.Data.SqlClient.SqlException was unhandled
Class=14
ErrorCode=-2146232060
LineNumber=65536
Message="Login failed for user 'sa'. The user is not associated with
a trusted SQL Server connection."
Number=18452
Procedure=""
Server="kris\SQLEXPRESS"
Have you enabled you server for SQL authetnication? By default,
SQL Server permits only Window authentication.

Do you have any particular reason you want to use SQL authentication?
Else, change "uid=sa;pwd=" to "Integrated Security=SSPI".
For logon in SQL Server configuration manager 'built- in account'
local system is selected rather than the 'this account' option which
has stars in the password field and no username options.
Note that his is about how SQL Server logs into Windows. That's a
different thing.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 13 '07 #2
Do you have any particular reason you want to use SQL authentication?
Else, change "uid=sa;pwd=" to "Integrated Security=SSPI".
Thanks, Erland. That helped move me on- in fact the first time I tried
it it seemed to work (though my record was not added- posibly as there
already existed a record with same id) Anyway- I cant experiment with
that cos shorlty after I could no longer connect- seems strange- I
checked the table after first successful run to see if it had updated
and ran the code again- got a message "another process is locking the
db"- great I thought- all is working- and closed the connection in
VS-
now though the connection gets stuck at login and says:

Cannot open database "pubs" requested by the login. The login failed.
Login failed for user 'KRISLAPTOP\Kris'.


Feb 14 '07 #3
DanWeaver (da*********@googlemail.com) writes:
>Do you have any particular reason you want to use SQL authentication?
Else, change "uid=sa;pwd=" to "Integrated Security=SSPI".

Thanks, Erland. That helped move me on- in fact the first time I tried
it it seemed to work (though my record was not added- posibly as there
already existed a record with same id) Anyway- I cant experiment with
that cos shorlty after I could no longer connect- seems strange- I
checked the table after first successful run to see if it had updated
and ran the code again- got a message "another process is locking the
db"- great I thought- all is working- and closed the connection in
VS-
now though the connection gets stuck at login and says:

Cannot open database "pubs" requested by the login. The login failed.
Login failed for user 'KRISLAPTOP\Kris'.
Seems like that either your user is not present in the pubs database,
or the database has somehow gone away.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 14 '07 #4
Thanks, Erland. Something fishy was ocurring with the dbs- deleted
them and reconnected and set permissions again- seems to work now.

Cheers, more challenging questions (when I am more informed!) will
probably follow.

Dan
Seems like that either your user is not present in the pubs database,
or the database has somehow gone away.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Feb 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ryan Stewart | last post by:
I'm running MySQL server on a WinXP box at home. I have a cable modem/router. I've set up port forwarding on port 3306 to the machine running MySQL. I can connect locally just fine, but when I try...
3
by: Bill | last post by:
When vb6 Winsock.RemoteHost is set to "127.0.0.1", c# socket listener cannot hear connect request (my old vb6 winsock listener could hear it...). Why doesn't this work, and is there a work...
5
by: Kona | last post by:
Hello, Is it right to tell that DB2 Connect has the same function that Oracle Net ? If I have an ODBC application is it also right to tell that I have 2 possibilities on my client workstation to...
30
by: aka | last post by:
Hi I have a DB2 v8.1 on AIX and DB2 Connect EE on Solaris wich is connected to OS/390 DB2 subsystems via APPC / SNA. I have cataloged the DB2 Connect instance as tcpip node and then the Host DB...
0
by: Zorba.GR | last post by:
IBM DB2 Connect Enterprise Edition v8.2, other IBM DB2 (32 bit, 64 bit) (MULTiOS, Windows, Linux, Solaris), IBM iSoft Commerce Suite Server Enterprise v3.2.01, IBM Tivoli Storage Resource Manager...
14
by: DaTurk | last post by:
I am makeing a Multicast server client setup and was wondering what the difference is between Socket.Connect, and Socket.Bind. It may be a stupid question, but I was just curious. Because I...
0
by: Clodoaldo Pinto | last post by:
Can't connect to postgresql server php error log message: PHP Warning: pg_connect() : Unable to connect to PostgreSQL server: could not connect to server: Permission denied\n\tIs the server...
14
by: Marcus | last post by:
I have a function that simply returns TRUE if it can connect to a particular Sql Server 2005 express, or FALSE if it cannot. I am getting some strange error codes returned when the computer that...
3
by: blackpuppy | last post by:
I am just beginner on PHP. I am reading "Spring Into PHP 5" but cannot make the ftp examples work. I am running PHP scripts on a Fedora Core 5 (VMWare virtual machine) on top of a Windows XP...
4
by: d3vkit | last post by:
Okay so I am at a loss here. I have a website that I've previously had no trouble connecting to the mysql DB on. I have an include to a connect file with the relevant connection info, and it was...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.