Hi all,
I'm missing something, probably stupid, on connecting to a SQL Server
database from an aspx file. I haven't really done much w/ SQL Server and
suspect that it's a problem on that side. I've installed the SQL Server
developer edition locally and do have a pubs database.
The connection I'm attempting is the following:
SqlConnection objConnection =
new SqlConnection( "server=localho st;database=pub ;uid=sa;pwd=adm in" );
try
{
// Open the connection.
objConnection.O pen();
/*snip*/
}
catch( Exception ex )
{
ErrorMessage.Te xt = ex.Message.ToSt ring();
}
The exception caught indicates (whether or not 'sa' is the uid I'm trying to
connect with):
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server
connection. (w/Windows-only Authentication) or
Login failed for user 'sa'. (Windows and SQL Server Authentication)
I have been able to create a connection through VFP (though using ODBC).
The connection string it creates is:
DSN=SQLServer1; UID=sa;PWD=admi n;APP=Microsoft Visual FoxPro;WSID=J2K , which
indicates to me that the sa/admin login is correct (which is what Iset at
installation).
Any ideas?
TIA,
John 14 1866
> DSN=SQLServer1;
How is this DSN=SQLServer1 configured? Does it use the name "localhost" or
does it use an actual computer name, or IP address? Are you sure it's set
for port 1433?
--
Aaron Bertrand
SQL Server MVP http://www.aspfaq.com/
Cross-posting is bad.
Is "localhost" and "SQLServer1 " actually the same machine? If not, is your
authentication on localhost "windows only"? Try some these connection
strings
"server=yourIPa ddressHere;data base=pubs;uid=s a;pwd=admin;"
"server=yourIPa ddressHere;data base=pubs;integ rated security=sspi;"
"server=localho st;database=pub s;integrated security=sspi;"
"server=SQLServ er1;database=pu bs;integrated security=sspi;"
"server=(local) ;database=pubs; uid=sa;pwd=admi n;"
"server=(local) ;database=pubs; integrated security=sspi;"
"server=.;datab ase=pubs;uid=sa ;pwd=admin;"
"server=.;datab ase=pubs;integr ated security=sspi;"
hth
Eric
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message
news:eX******** *******@TK2MSFT NGP11.phx.gbl.. . Hi all,
I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server and suspect that it's a problem on that side. I've installed the SQL Server developer edition locally and do have a pubs database.
The connection I'm attempting is the following:
SqlConnection objConnection = new SqlConnection(
"server=localho st;database=pub ;uid=sa;pwd=adm in" ); try { // Open the connection. objConnection.O pen(); /*snip*/ } catch( Exception ex ) { ErrorMessage.Te xt = ex.Message.ToSt ring(); }
The exception caught indicates (whether or not 'sa' is the uid I'm trying
to connect with): Login failed for user 'sa'. Reason: Not associated with a trusted SQL
Server connection. (w/Windows-only Authentication) or Login failed for user 'sa'. (Windows and SQL Server Authentication)
I have been able to create a connection through VFP (though using ODBC). The connection string it creates is: DSN=SQLServer1; UID=sa;PWD=admi n;APP=Microsoft Visual FoxPro;WSID=J2K ,
which indicates to me that the sa/admin login is correct (which is what Iset at installation).
Any ideas?
TIA,
John
Thanks, Aaron. And sorry in advance for my newbie ignorance...
The DSN is a system DSN, configured as connecting to server "J2K" (which is
the name of the computer as well as of the SQL Server), using the TCP/IP
network library set to dynamically determine port (but, yes, the default
port is 1433). I can't find any reference to localhost in the DSN.
BTW, I don't think the ADO connection is attempting to use the DSN (but
could be COMPLETELY misinterpreting things).
- John
The default port is 1433.
"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:#S******** ******@tk2msftn gp13.phx.gbl... DSN=SQLServer1; How is this DSN=SQLServer1 configured? Does it use the name "localhost"
or does it use an actual computer name, or IP address? Are you sure it's set for port 1433?
-- Aaron Bertrand SQL Server MVP http://www.aspfaq.com/
> The DSN is a system DSN, configured as connecting to server "J2K"
So try
new SqlConnection( "server=J2K;dat abase=pub;uid=s a;pwd=admin" );
--
Aaron Bertrand
SQL Server MVP http://www.aspfaq.com/
(which is the name of the computer as well as of the SQL Server), using the TCP/IP network library set to dynamically determine port (but, yes, the default port is 1433). I can't find any reference to localhost in the DSN.
BTW, I don't think the ADO connection is attempting to use the DSN (but could be COMPLETELY misinterpreting things).
- John
The default port is 1433. "Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message news:#S******** ******@tk2msftn gp13.phx.gbl... DSN=SQLServer1;
How is this DSN=SQLServer1 configured? Does it use the name "localhost"
or does it use an actual computer name, or IP address? Are you sure it's
set for port 1433?
-- Aaron Bertrand SQL Server MVP http://www.aspfaq.com/
Hi,
If it's SQL2K, then you've probably not got the server in Mixed mode. Go
into enterprise manager and right click on the server (should be the same
name as the computer unless you've changed it) and go into the properties
page.
Go to the security page and you'll find an Authentication option. Select
SQL server and Windows. Important note here...You must make sure you change
the SA password to a nice long password with lots of _£$@} characters in,
otherwise, if you have broadband you'll be hacked to pieces.
You need to have the database server in mixed mode if you want to use forms
authentication (sounds like you do). Otherwise you might want to consider
integrated security, in which case you don't use uid and pwd in your
connection string and you ignore everything I've written above.
Have fun....welcome to the DBA's world!
P
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message
news:eX******** *******@TK2MSFT NGP11.phx.gbl.. . Hi all,
I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server and suspect that it's a problem on that side. I've installed the SQL Server developer edition locally and do have a pubs database.
The connection I'm attempting is the following:
SqlConnection objConnection = new SqlConnection(
"server=localho st;database=pub ;uid=sa;pwd=adm in" ); try { // Open the connection. objConnection.O pen(); /*snip*/ } catch( Exception ex ) { ErrorMessage.Te xt = ex.Message.ToSt ring(); }
The exception caught indicates (whether or not 'sa' is the uid I'm trying
to connect with): Login failed for user 'sa'. Reason: Not associated with a trusted SQL
Server connection. (w/Windows-only Authentication) or Login failed for user 'sa'. (Windows and SQL Server Authentication)
I have been able to create a connection through VFP (though using ODBC). The connection string it creates is: DSN=SQLServer1; UID=sa;PWD=admi n;APP=Microsoft Visual FoxPro;WSID=J2K ,
which indicates to me that the sa/admin login is correct (which is what Iset at installation).
Any ideas?
TIA,
John
Thanks to all of you (Aaron, Mklapp, Eric & Paul) for jumping in. So far,
I've still had no luck.
This is a list of the connections I've tried so far:
server=localhos t;database=pubs ;uid=jspiegel;p wd=abc;
server=J2K;data base=pubs;uid=j spiegel;pwd=abc ;
server=J2K;data base=pubs;uid=s a;pwd=admin;Tru sted_Connection =Yes
server=localhos t;database=pubs ;uid=sa;pwd=adm in;Trusted_Conn ection=Yes
server=localhos t;database=pubs ;uid=sa;pwd=adm in
server=J2K;data base=pubs;uid=s a;pwd=admin
server=localhos t;database=pubs ;Trusted_Connec tion=Yes
server=<IPaddre ss>;database=pu bs;uid=sa;pwd=a dmin;
server=<IPaddre ss>;database=pu bs;integrated security=sspi;
server=localhos t;database=pubs ;integrated security=sspi;
server=SQLServe r1;database=pub s;integrated security=sspi;
server=(local); database=pubs;u id=sa;pwd=admin ;
server=(local); database=pubs;i ntegrated security=sspi;
server=.;databa se=pubs;uid=sa; pwd=admin;
server=.;databa se=pubs;integra ted security=sspi;
The uid=jspiegel;pw d=abc correspond both to a domain login and a user I've
added to SQL Server.
While I am logged into the domain, all of this is happening (or trying to
happen) on my local machine (Win2K Pro, SQL Server 2000 and .NET framework
1.1).
While I have toggled it a few times, most of my attempts have been with SQL
Server and Windows set as the authentication.
I had installed MSDE quite a while ago and then the SQL Server trial
version. Yesterday, I tried to wipe the slate clean and reinstall MSSQL2K
fresh. Probably doesn't answer anything but I'm grasping.
Thanks again,
John
BTW, I think I was spoiled years ago working in a single environment with
native DB. This interconnection stuff drives me batty!
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message
news:eX******** *****@TK2MSFTNG P11.phx.gbl... Hi all,
I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server and suspect that it's a problem on that side. I've installed the SQL Server developer edition locally and do have a pubs database.
The connection I'm attempting is the following:
SqlConnection objConnection = new SqlConnection(
"server=localho st;database=pub ;uid=sa;pwd=adm in" ); try { // Open the connection. objConnection.O pen(); /*snip*/ } catch( Exception ex ) { ErrorMessage.Te xt = ex.Message.ToSt ring(); }
The exception caught indicates (whether or not 'sa' is the uid I'm trying
to connect with): Login failed for user 'sa'. Reason: Not associated with a trusted SQL
Server connection. (w/Windows-only Authentication) or Login failed for user 'sa'. (Windows and SQL Server Authentication)
I have been able to create a connection through VFP (though using ODBC). The connection string it creates is: DSN=SQLServer1; UID=sa;PWD=admi n;APP=Microsoft Visual FoxPro;WSID=J2K ,
which indicates to me that the sa/admin login is correct (which is what Iset at installation).
Any ideas?
TIA,
John
Have you been to www.connectionstrings.com?
--
Aaron Bertrand
SQL Server MVP http://www.aspfaq.com/
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message
news:uL******** ******@TK2MSFTN GP09.phx.gbl... Thanks to all of you (Aaron, Mklapp, Eric & Paul) for jumping in. So far, I've still had no luck.
This is a list of the connections I've tried so far:
server=localhos t;database=pubs ;uid=jspiegel;p wd=abc; server=J2K;data base=pubs;uid=j spiegel;pwd=abc ; server=J2K;data base=pubs;uid=s a;pwd=admin;Tru sted_Connection =Yes server=localhos t;database=pubs ;uid=sa;pwd=adm in;Trusted_Conn ection=Yes server=localhos t;database=pubs ;uid=sa;pwd=adm in server=J2K;data base=pubs;uid=s a;pwd=admin server=localhos t;database=pubs ;Trusted_Connec tion=Yes server=<IPaddre ss>;database=pu bs;uid=sa;pwd=a dmin; server=<IPaddre ss>;database=pu bs;integrated security=sspi; server=localhos t;database=pubs ;integrated security=sspi; server=SQLServe r1;database=pub s;integrated security=sspi; server=(local); database=pubs;u id=sa;pwd=admin ; server=(local); database=pubs;i ntegrated security=sspi; server=.;databa se=pubs;uid=sa; pwd=admin; server=.;databa se=pubs;integra ted security=sspi;
The uid=jspiegel;pw d=abc correspond both to a domain login and a user I've added to SQL Server.
While I am logged into the domain, all of this is happening (or trying to happen) on my local machine (Win2K Pro, SQL Server 2000 and .NET framework 1.1).
While I have toggled it a few times, most of my attempts have been with
SQL Server and Windows set as the authentication.
I had installed MSDE quite a while ago and then the SQL Server trial version. Yesterday, I tried to wipe the slate clean and reinstall MSSQL2K fresh. Probably doesn't answer anything but I'm grasping.
Thanks again,
John
BTW, I think I was spoiled years ago working in a single environment with native DB. This interconnection stuff drives me batty!
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message news:eX******** *****@TK2MSFTNG P11.phx.gbl... Hi all,
I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server
and suspect that it's a problem on that side. I've installed the SQL Server developer edition locally and do have a pubs database.
The connection I'm attempting is the following:
SqlConnection objConnection = new SqlConnection( "server=localho st;database=pub ;uid=sa;pwd=adm in" ); try { // Open the connection. objConnection.O pen(); /*snip*/ } catch( Exception ex ) { ErrorMessage.Te xt = ex.Message.ToSt ring(); }
The exception caught indicates (whether or not 'sa' is the uid I'm
trying to connect with): Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. (w/Windows-only Authentication) or Login failed for user 'sa'. (Windows and SQL Server Authentication)
I have been able to create a connection through VFP (though using ODBC). The connection string it creates is: DSN=SQLServer1; UID=sa;PWD=admi n;APP=Microsoft Visual FoxPro;WSID=J2K , which indicates to me that the sa/admin login is correct (which is what Iset
at installation).
Any ideas?
TIA,
John
Hey Eric,
Aside from the connection issue... Cross-posting is bad.
I've seen this dozens of times (part of why 90+% of the time I don't do it).
But I've never really understood what the problem is--particularly in a case
where there are multiple technologies thrown in the mix. Is it a resource
issue for the newserver or confusion/clutter issue for the readers? Just
trying to understand.
Sorry for being bad,
John
Heading there now!
"Aaron Bertrand - MVP" <aa***@TRASHasp faq.com> wrote in message
news:OT******** ******@TK2MSFTN GP12.phx.gbl... Have you been to www.connectionstrings.com?
-- Aaron Bertrand SQL Server MVP http://www.aspfaq.com/
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in message news:uL******** ******@TK2MSFTN GP09.phx.gbl... Thanks to all of you (Aaron, Mklapp, Eric & Paul) for jumping in. So
far, I've still had no luck.
This is a list of the connections I've tried so far:
server=localhos t;database=pubs ;uid=jspiegel;p wd=abc; server=J2K;data base=pubs;uid=j spiegel;pwd=abc ; server=J2K;data base=pubs;uid=s a;pwd=admin;Tru sted_Connection =Yes server=localhos t;database=pubs ;uid=sa;pwd=adm in;Trusted_Conn ection=Yes server=localhos t;database=pubs ;uid=sa;pwd=adm in server=J2K;data base=pubs;uid=s a;pwd=admin server=localhos t;database=pubs ;Trusted_Connec tion=Yes server=<IPaddre ss>;database=pu bs;uid=sa;pwd=a dmin; server=<IPaddre ss>;database=pu bs;integrated security=sspi; server=localhos t;database=pubs ;integrated security=sspi; server=SQLServe r1;database=pub s;integrated security=sspi; server=(local); database=pubs;u id=sa;pwd=admin ; server=(local); database=pubs;i ntegrated security=sspi; server=.;databa se=pubs;uid=sa; pwd=admin; server=.;databa se=pubs;integra ted security=sspi;
The uid=jspiegel;pw d=abc correspond both to a domain login and a user
I've added to SQL Server.
While I am logged into the domain, all of this is happening (or trying
to happen) on my local machine (Win2K Pro, SQL Server 2000 and .NET
framework 1.1).
While I have toggled it a few times, most of my attempts have been with SQL Server and Windows set as the authentication.
I had installed MSDE quite a while ago and then the SQL Server trial version. Yesterday, I tried to wipe the slate clean and reinstall
MSSQL2K fresh. Probably doesn't answer anything but I'm grasping.
Thanks again,
John
BTW, I think I was spoiled years ago working in a single environment
with native DB. This interconnection stuff drives me batty!
"John Spiegel" <js******@YETAN OTHERSPAMHATERc-comld.com> wrote in
message news:eX******** *****@TK2MSFTNG P11.phx.gbl... Hi all,
I'm missing something, probably stupid, on connecting to a SQL Server database from an aspx file. I haven't really done much w/ SQL Server and suspect that it's a problem on that side. I've installed the SQL
Server developer edition locally and do have a pubs database.
The connection I'm attempting is the following:
SqlConnection objConnection = new SqlConnection(
"server=localho st;database=pub ;uid=sa;pwd=adm in" ); try { // Open the connection. objConnection.O pen(); /*snip*/ } catch( Exception ex ) { ErrorMessage.Te xt = ex.Message.ToSt ring(); }
The exception caught indicates (whether or not 'sa' is the uid I'm trying to connect with): Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. (w/Windows-only Authentication) or Login failed for user 'sa'. (Windows and SQL Server Authentication)
I have been able to create a connection through VFP (though using
ODBC). The connection string it creates is: DSN=SQLServer1; UID=sa;PWD=admi n;APP=Microsoft Visual FoxPro;WSID=J2K , which indicates to me that the sa/admin login is correct (which is what Iset at installation).
Any ideas?
TIA,
John
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Google Mike |
last post by:
After a lot of thought and research, and playing with FreeTDS and
InlineTDS, as well as various ODBC connections, I have determined that
the fastest and cheapest way to get up and going with PHP on Linux,
connecting to MS SQL Server, unless it was already pre-installed by
your Linux installation, is to build your own multithreaded TCP socket
server on Windows and connect to it through the socket API in PHP on
Linux (if you have installed...
|
by: Ann Marinas |
last post by:
Hi all,
I would like to ask for some help regarding separating the asp.net
webserver and the sql server.
I have created an asp.net application for a certain company. Initially,
we installed both the iis and sql server in a single machine. Not too
long ago, the machine had some hardware problems, and management has
decided to purchase new servers, for both asp.net and sql server.
|
by: Ann Marinas |
last post by:
Hi there,
I am currently developing an ASP.NET program that connects to a SQL Server
2000 database. I also have SQL Server 2005 Express installed on the same
local machine.
Prior to installing SQL Server 2005, my apps were working and is connecting
flawlessly to a database on the SQL Server 2000. Now, whenever I connect to
the same database with the 2005 version installed, I keep on getting this
error:
|
by: cj.snead |
last post by:
Hello,
I am having trouble connecting to a remote named instance of SQL Server
via Pocket PC. I have had absolutely no luck connecting with VS 2005
(even to a default instance), so I wen't back to VS .NET 2003 (I had
success doing this a while back).
I am trying to connect to a named instance of SQL. This is where I
think my problem is. My app errors out at the Connection.Open();
command.
Here is my connection string:
|
by: Vinod R.Shenoy |
last post by:
Hi All,
Came across a post wherin you had helped somebody with a similar
problem and was wondering if you could help us out with it.
Our problem is ,
We have a development SQL Server 2000 (running on Win2K SP4) machine
that we want to run on a Windows 2003 server machine and access it via
our internal LAN. We have opened the firewall to allow our applications
| |
by: Todd Brewer |
last post by:
Windows Server 2000
ASP.NET 2.0
SQL Server 2000 (on a physically seperate server)
I moved an ASP.NET 2.0 application from a development server to production,
and am getting the following error:
System.Data.SqlClient.SqlException: An error has occurred while establishing
a connection to the server. When connecting to SQL Server 2005, this failure
may be caused by the fact that under the default settings SQL Server does not
|
by: mairhtin o'feannag |
last post by:
Hello,
I'm having problems connecting to my new v9 db box. The pertinent
information is below:
DB2_db2inst1 60000/tcp
DB2_db2inst1_1 60001/tcp
DB2_db2inst1_2 60002/tcp
DB2_db2inst1_END 60003/tcp
|
by: samadams_2006 |
last post by:
Hello,
I have a problem that I'm hoping someone will be able to help me
resolve.
1) I have a C# Web Site in which I connect to the database: "Install
Microsoft SQL Server 2005 Express Edition" via the link on:
http://msdn2.microsoft.com/en-us/express/bb410792.aspx
|
by: orandov |
last post by:
Hi,
I am having a problem connecting my .net applications from the
application server to the database server. When I run the application
from my windows xp (sp2) box it works fine. When I try to connect via
SQL Management Studio to the database server from the application
server I get the same error.
Here is the error:
|
by: aboutjav.com |
last post by:
Hi,
I need some help. I am getting this error after I complete the asp.net
register control and click on the continue button. It crashed when it
tries to get
it calls this Profile property
((string)(this.GetPropertyValue("Address1")));
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |