Showing posts with label environment. Show all posts
Showing posts with label environment. Show all posts

Monday, March 19, 2012

Assistance in connecting a SQL Server Client to SQL Server sitting in a shared environment

Hi,

I need to connect to a SQL server thats running in say abc.trident.com and also sits in a shared environment..

I have couple of questions

1) That SQL server is accessible from my network, yet when I swtich on my enterprise manager I am unable to view that in the list of running SQL servers in the populated list.

Is it because its sitting in a shared environment I am unable to view that?

2) What is the connection striing I should use to connect to the server..When I try to configure a SQL server registrations it normally asks for SQL Server name along with the user authentication

Should I mention fill the Server: field as

abc.trident.com

or

// abc.trident.com/abc.trident.com

to connect to the clustered server.

Can some one tell me the proper connection string if both aforementioned ones are incorrect?

Thanks in Advance

What error it throws !?

1) That SQL server is accessible from my network, yet when I swtich on my enterprise manager I am unable to view that in the list of running SQL servers in the populated list.

Is it because its sitting in a shared environment I am unable to view that?

>> Is this server is out side your network!!!? have you tried connecting using QA? is NET DDE and NET DDE DDSM service are running ? Is NETBIOS enabled?

2) What is the connection striing I should use to connect to the server..When I try to configure a SQL server registrations it normally asks for SQL Server name along with the user authentication

Should I mention fill the Server: field as

abc.trident.com

or

// abc.trident.com/abc.trident.com

to connect to the clustered server.

Refer connectionstring.com for different connection strings.

Regards

Hemantgiri S. Goswami

|||

1) is NET DDE and NET DDE DDSM service are running ? Is NETBIOS enabled?

Yes

2) The connectionstring.com site appears to be dead and has some irrevlant ads. can you tell me if my connection string format to represent a Clustered SQL server is correct or any other site from which I can get the accurate info

Efforts in googling ended in vain.

3) The error

<SQLServer does not exist or access denied ConnectionOpen.connect())>

Here the SQL server lies out side my network and the network is even accessible from a Tracert.

but the SQL server is up and running according to the Admin.

|||No takers!|||

Hi,

You have said that the server is outside network.... If it is behind firewall have you check the proper firewall rule is placed in order to get you access !? and Port too...

Refer this KB for the workaround http://support.microsoft.com/kb/328306/en-us

Hemantgiri S. Goswami

Sunday, March 11, 2012

assigning user to a database programmatically

Environment : vc.net , SQL Server
Hi All,
I have programmatically created an SQL Server database
by executing the script file for it. I have logged in as administrator
for creating the above database in my vc.net code using SQL APIs.
Now i need to assign a new user and pasword to this database
i have created in my program. Is there a way to do it ?
Regards,
Asif
Use sp_addlogin for adding the login to the database, then use sp_grantdbaccess to grant your user access to the database. If you then want to add the user to a role use sp_addrolemember
hth,
Lance

assigning user to a database programmatically

Environment : vc.net , SQL Server
Hi All,
I have programmatically created an SQL Server database
by executing the script file for it. I have logged in as administrator
for creating the above database in my vc.net code using SQL APIs.
Now i need to assign a new user and pasword to this database
i have created in my program. Is there a way to do it ?
Regards,
AsifUse sp_addlogin for adding the login to the database, then use sp_grantdbacc
ess to grant your user access to the database. If you then want to add the
user to a role use sp_addrolemember
hth,
Lance

Sunday, February 19, 2012

ASP2.0 INSERT into SQL2000 problems

First thanks for any help anyone can give me. Here is the environment: SQL2000 server, 2003 Web server, ASP2.0, SQL

I've banged my head around trying to get this code to insert some data into a table cell on a db table, and it simply is not working, through trial and error i've figured that I simply have wrote crappy sql code so if anyone can give it a look over and see if they notice what the devil I missed, it would be much appreciated, if you need to see more of the code give me a shout.

If (Page.IsValid = True)

' MailClient.Send(MailFrom, MailTo, MailSubject, MailBody)'

Dim SQLConn As SqlConnection = New SqlConnection()
SQLConn.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
SQLConn.Open()
Dim strSQL As String = "INSERT INTO kittens (email) VALUES (frogger);"
SQLConn.Close()

End If
End Sub

Remove the semi-colin from ther end of the query, also 'frogger' should be encapsulated in single quotes. All text, ntext, varchar, nvarchar, etc.. need to have their values in quotes unless passed through a variable.

INSERT INTO kittens (email) VALUES ('frogger')

|||

bluemistonline:

Remove the semi-colin from ther end of the query, also 'frogger' should be encapsulated in single quotes. All text, ntext, varchar, nvarchar, etc.. need to have their values in quotes unless passed through a variable.

INSERT INTO kittens (email) VALUES ('frogger')

Did you also mean for me to take the "" from the statements as well? With those taken out I get a (BC30205: End of statement expected) error.

I guess I will post the whole code (the nonhtml stuff anyway) and see if anyone notices anything. I'm beginning to wonder if I have the sql table itself not set up right somehow. As is obvious I am very new to ASP.net and SQL as in I new nothing about how to code either until I started on this recent project so I am learning by doing :b

login.aspx code

<%@. Page Explicit="true" debug="true" language="vb" %>
<%@. Import Namespace="System.Data" %>
<%@. Import Namespace="System.Data.SqlClient" %>
<%@. Import Namespace="System.Data.Mail" %>
<%@. Import Namespace="System.Net.Mail" %>

<script runat="server">
Sub submitClick(Source as Object, E as EventArgs)

Dim eMsg as String

eMsg +="Customer Information" & vbcrlf
eMsg +="Email: " & txtEmail.Text & vbcrlf
eMsg +="Company: " & txtCompany.Text & vbcrlf
eMsg +="Last Name: " & txtLastName.Text & vbcrlf
eMsg +="First Name: " & txtFirstName.Text & vbcrlf
eMsg +="Phone Number: " & txtPhoneNumber.Text & vbcrlf

Dim MailClient = New SmtpClient("xxx.xxxx.xxx.xxxxx")
Dim MailFrom As String = "mittens@.mittens.com"
Dim MailTo As String = "scarf@.scarf.com"
Dim MailSubject As String = "New Customer Information"
Dim MailBody As String = eMsg

If (Page.IsValid = True)

' MailClient.Send(MailFrom, MailTo, MailSubject, MailBody)'

Dim SQLConn As SqlConnection = New SqlConnection()
SQLConn.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
SQLConn.Open()
Dim strSQL As String = INSERT INTO cuinfo ('email') VALUES ('frogger')
SQLConn.Close()

End If
End Sub

</script>

And this is the web.config

<configuration>
<appSettings>
<add key="ConnectionString" value="DataSource=mittens@.mittens.com;UID=mittens;pwd=itsasecret" />
<add key="ConnectionString" value="Server=xxx.xxxx.xxx.xxxxx;database=kittens;UID=mew;pwd=mewmew;Trusted_Connection=True" />
</appSettings>
<system.web>
<sessionState cookieless="false" timeout="20" />
<customErrors mode="Off"/>
</system.web>
</configuration>

For the SQL table itself, the UID "mew" doesn't have to be owner of the table correct, the only they need is the write access. Currently what happens is the submit button on login.aspx is clicked and the screen refreshes without any errors, and the email with the data is sent (or would be if I didn't have it commented out right now), but nothing appears in the database table. I manually go to the table and right-click tell it to show all rows and it shows an empty table. The email column is empty and in this case frogger does not show up in it.

Thx for any help.

|||

No put the double quotes back. Basic .NET systax requires you to encapsulate all string values in double quotes!!!

Maybe your should brush up on .NET systax before posting absurd questions.

Here is a good link:http://authors.aspalliance.com/aspxtreme/aspnet/syntax/aspnetsyntax.aspx

|||

Change:

SQLConn.Open()
Dim strSQL As String = INSERT INTO cuinfo ('email') VALUES ('frogger')
SQLConn.Close()

to:

SQLConn.Open()

Dim cmd as new SqlCommand("INSERT INTO cuinfo(email) VALUES (@.email)",SQLConn)

cmd.Parameters.Add("@.email",sqldbtype.Varchar).Value=txtEmail.Text

cmd.ExecuteNonQuery

SQLConn.Close

|||

Thx Motley, that seemed to fix that problem, a new one cropped up, but I'm going to try and work it, before deciding whether to post for help.

Thx again for the help Motley.

Thursday, February 16, 2012

ASP.NET/IIS/SQL help !

Hi.

Let me tell you my domain environment. It's NT 4.0 domain with a
Windows 2000 member server running as ASP.NET/IIS/MS SQL 2000, all in one
box, and it worked fine. Recently, we bought a new box with Windows 2003
standard version and trying to move ASP.NET and IIS to this box. However;
we're getting "Login failed for user 'NT Authority\Anonymous Logon'" error
when we access the ASP.NET page. I believe it has something to do with
moving the asp.net/iis to a different box and leave SQL in the old box. I've
done some research and there're some possibilities that have caused this:

1. It would require Active Directory domain environment when you move
asp.net/iis to a different box and authenticates with the SQL
server on the old box?

2. ASPNET account locally on both boxes need to be matched?

3. reconfigure the Machine.config and Web.config in the asp.net?

Can anyone help me on this with the details?

ThanksHi Charlie

Not exactly sure why you are getting this error but it sounds it's more
a problem of the IIS configuration than SQL Server. You might want to
repost in an IIS group.

If you place a very simple index.aspx (a blank webform) in the root of
your website on the Windows 2003 box and try calling it like
http://localhost/myapp/index.aspx - Do you get the same error? In this
case it's a pure IIS problem. Check the properties of your web
application root and make sure that anonymous logon is enabled.

Also check that you have the right settings in web.config.

<!-- AUTHENTICATION
This section sets the authentication policies of the application.
Possible modes are "Windows", "Forms", "Passport" and "None"

"None" No authentication is performed.
"Windows" IIS performs authentication (Basic, Digest, or Integrated
Windows) according to its settings for the application. Anonymous
access must be disabled in IIS.
"Forms" You provide a custom form (Web page) for users to enter their
credentials, and then you authenticate them in your application. A user
credential token is stored in a cookie.
"Passport" Authentication is performed via a centralized
authentication service provided
by Microsoft that offers a single logon and core profile services for
member sites.
--
Let me know the result.

M

ASP.NET/IIS/SQL help

Hi.
Let me tell you my domain environment. It's NT 4.0 domain with a
Windows 2000 member server running as ASP.NET/IIS/MS SQL 2000, all in one
box, and it worked fine. Recently, we bought a new box with Windows 2003
standard version and trying to move ASP.NET and IIS to this box. However;
we're getting "Login failed for user 'NT Authority\Anonymous Logon'" error
when we access the ASP.NET page. I believe it has something to do with
moving the asp.net/iis to a different box and leave SQL in the old box. I've
done some research and there're some possibilities that have caused this:
1. It would require Active Directory domain environment when you move
asp.net/iis to a different box and authenticates with the SQL
server on the old box?
2. ASPNET account locally on both boxes need to be matched?
3. reconfigure the Machine.config and Web.config in the asp.net?
Can anyone help me on this with the details?
Thanks
"Charlie Ting" <cting74@.hotmail.com> wrote in
news:O6ednQldj8dcG4vfRVn-sw@.golden.net:

> we're getting "Login failed for user 'NT
> Authority\Anonymous Logon'" error when we access the ASP.NET page. I
> believe it has something to do with moving the asp.net/iis to a
> different box and leave SQL in the old box.
My knowledge is limited. but I'll hazard a good guess...
As IIS is on a new server the IUSER_newservername is being used to access
the virtual directory, which in turn is not an authenticated user as far as
sql server is concerned.
Hope it helps?

ASP.NET/IIS/SQL help

Hi.
Let me tell you my domain environment. It's NT 4.0 domain with a
Windows 2000 member server running as ASP.NET/IIS/MS SQL 2000, all in one
box, and it worked fine. Recently, we bought a new box with Windows 2003
standard version and trying to move ASP.NET and IIS to this box. However;
we're getting "Login failed for user 'NT Authority\Anonymous Logon'" error
when we access the ASP.NET page. I believe it has something to do with
moving the asp.net/iis to a different box and leave SQL in the old box. I've
done some research and there're some possibilities that have caused this:
1. It would require Active Directory domain environment when you move
asp.net/iis to a different box and authenticates with the SQL
server on the old box?
2. ASPNET account locally on both boxes need to be matched?
3. reconfigure the Machine.config and Web.config in the asp.net?
Can anyone help me on this with the details?
Thanks"Charlie Ting" <cting74@.hotmail.com> wrote in
news:O6ednQldj8dcG4vfRVn-sw@.golden.net:

> we're getting "Login failed for user 'NT
> Authority\Anonymous Logon'" error when we access the ASP.NET page. I
> believe it has something to do with moving the asp.net/iis to a
> different box and leave SQL in the old box.
My knowledge is limited. but I'll hazard a good guess...
As IIS is on a new server the IUSER_newservername is being used to access
the virtual directory, which in turn is not an authenticated user as far as
sql server is concerned.
Hope it helps'

ASP.NET/IIS/SQL help

Hi.
Let me tell you my domain environment. It's NT 4.0 domain with a
Windows 2000 member server running as ASP.NET/IIS/MS SQL 2000, all in one
box, and it worked fine. Recently, we bought a new box with Windows 2003
standard version and trying to move ASP.NET and IIS to this box. However;
we're getting "Login failed for user 'NT Authority\Anonymous Logon'" error
when we access the ASP.NET page. I believe it has something to do with
moving the asp.net/iis to a different box and leave SQL in the old box. I've
done some research and there're some possibilities that have caused this:
1. It would require Active Directory domain environment when you move
asp.net/iis to a different box and authenticates with the SQL
server on the old box?
2. ASPNET account locally on both boxes need to be matched?
3. reconfigure the Machine.config and Web.config in the asp.net?
Can anyone help me on this with the details?
Thanks"Charlie Ting" <cting74@.hotmail.com> wrote in
news:O6ednQldj8dcG4vfRVn-sw@.golden.net:
> we're getting "Login failed for user 'NT
> Authority\Anonymous Logon'" error when we access the ASP.NET page. I
> believe it has something to do with moving the asp.net/iis to a
> different box and leave SQL in the old box.
My knowledge is limited. but I'll hazard a good guess...
As IIS is on a new server the IUSER_newservername is being used to access
the virtual directory, which in turn is not an authenticated user as far as
sql server is concerned.
Hope it helps'

Monday, February 13, 2012

asp.net sql connection problem

Hi all,
I have a production environment where I have a 2-node SQL 2005 Cluster
running on boxes which are part of a domain "MyCompany". I have setup a
domain user account called "netasp" and then given it permissions to the
database. I then setup a new App Pool in IIS on my Web Server (not part of
domain, can access SQL server via TCP) with identity setup to a local
account called "netasp" with the same password as the domain user account. I
then setup my website under this App Pool and tried my app. For some reason
it will not connect. This works in a development environment where my web &
sql is on the same box (non cluster environment). How do I go about getting
this to work? For security reasons, my web servers cannot be part of the
domain.
TIA!On Tue, 18 Apr 2006 02:48:39 -0500, <param@.community.nospam> wrote:
Hi all,
I have a production environment where I have a 2-node SQL 2005 Cluster
running on boxes which are part of a domain "MyCompany". I have setup a
domain user account called "netasp" and then given it permissions to the
database. I then setup a new App Pool in IIS on my Web Server (not part of
domain, can access SQL server via TCP) with identity setup to a local
account called "netasp" with the same password as the domain user account.
I
then setup my website under this App Pool and tried my app. For some reaso
n
it will not connect. This works in a development environment where my web
&
sql is on the same box (non cluster environment). How do I go about gettin
g
this to work? For security reasons, my web servers cannot be part of the
domain.
Is your web app and database connection configured for Windows integrated se
curity? If so you
probably have a delegation issue.
Paul
~~~~
Microsoft MVP (Visual Basic)|||My web app actually uses forms authentication by authenticating against the
database. I have heard of cases where people got this to work. I just need
some guidance/help in getting it to work.
TIA!
"Paul Clement" <UseAdddressAtEndofMessage@.swspectrum.com> wrote in message
news:dhl942hp9ifa1gncs1aokpfdqn2s2d1tjp@.
4ax.com...
> On Tue, 18 Apr 2006 02:48:39 -0500, <param@.community.nospam> wrote:
> Hi all,
>
> I have a production environment where I have a 2-node SQL 2005 Cluster
> running on boxes which are part of a domain "MyCompany". I have setup a
> domain user account called "netasp" and then given it permissions to the
> database. I then setup a new App Pool in IIS on my Web Server (not part
> of
> domain, can access SQL server via TCP) with identity setup to a local
> account called "netasp" with the same password as the domain user
> account. I
> then setup my website under this App Pool and tried my app. For some
> reason
> it will not connect. This works in a development environment where my
> web &
> sql is on the same box (non cluster environment). How do I go about
> getting
> this to work? For security reasons, my web servers cannot be part of the
> domain.
>
> Is your web app and database connection configured for Windows integrated
> security? If so you
> probably have a delegation issue.
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)|||The problem is that you gave permissions to the domain account, but you
running it as a local account. The remote SQL Server doesn't know about
your local 'netasp', it only knows about the domain one. I'm not sure you
can 'fool' the SQL server in thinking that the local machine account of the
remote web server is the same thing as the domain account it knows about. I
think you'd have to make your web server part of the domain, and run it
under the domain account. That, or just use username/password for the the
sql server authentication instead of integrated.
<param@.community.nospam> wrote in message
news:ODwLDyrYGHA.4652@.TK2MSFTNGP04.phx.gbl...
> Hi all,
> I have a production environment where I have a 2-node SQL 2005 Cluster
> running on boxes which are part of a domain "MyCompany". I have setup a
> domain user account called "netasp" and then given it permissions to the
> database. I then setup a new App Pool in IIS on my Web Server (not part of
> domain, can access SQL server via TCP) with identity setup to a local
> account called "netasp" with the same password as the domain user account.
> I then setup my website under this App Pool and tried my app. For some
> reason it will not connect. This works in a development environment where
> my web & sql is on the same box (non cluster environment). How do I go
> about getting this to work? For security reasons, my web servers cannot be
> part of the domain.
> TIA!
>|||I would love to use SQL Auth, but the beauty of windows auth is I dont have
to specify the username/pwd in the config file. Is there no way at all to
get this to work? Does MS recommend putting your Web Servers in the same
domain as the SQL? Our security consultant told us never to do that. Leave
the Web in the DMZ..
TIA!
"Marina Levit [MVP]" <someone@.nospam.com> wrote in message
news:eOeZGZvYGHA.3848@.TK2MSFTNGP05.phx.gbl...
> The problem is that you gave permissions to the domain account, but you
> running it as a local account. The remote SQL Server doesn't know about
> your local 'netasp', it only knows about the domain one. I'm not sure you
> can 'fool' the SQL server in thinking that the local machine account of
> the remote web server is the same thing as the domain account it knows
> about. I think you'd have to make your web server part of the domain, and
> run it under the domain account. That, or just use username/password for
> the the sql server authentication instead of integrated.
> <param@.community.nospam> wrote in message
> news:ODwLDyrYGHA.4652@.TK2MSFTNGP04.phx.gbl...
>|||I can't say I have complete knowledge of windows security, but I don't know
how to get this to work, although there could be a way.
First off, if someone gets access to your web server, you could argue that
they will get access to the sql server through windows authentication if
they really try anyway - so it will be the same as if they saw the
username/password in the config file.
As far as storing the username/password in the config file (or elsewhere in
a different file, even outside your virtual directory), you could encrypt
the connection information to provide an extra level of security.
<param@.community.nospam> wrote in message
news:uYxROfvYGHA.3532@.TK2MSFTNGP05.phx.gbl...
>I would love to use SQL Auth, but the beauty of windows auth is I dont have
>to specify the username/pwd in the config file. Is there no way at all to
>get this to work? Does MS recommend putting your Web Servers in the same
>domain as the SQL? Our security consultant told us never to do that. Leave
>the Web in the DMZ..
> TIA!
> "Marina Levit [MVP]" <someone@.nospam.com> wrote in message
> news:eOeZGZvYGHA.3848@.TK2MSFTNGP05.phx.gbl...
>|||On Tue, 18 Apr 2006 09:53:06 -0500, <param@.community.nospam> wrote:
I would love to use SQL Auth, but the beauty of windows auth is I dont hav
e
to specify the username/pwd in the config file. Is there no way at all to
get this to work? Does MS recommend putting your Web Servers in the same
domain as the SQL? Our security consultant told us never to do that. Leave
the Web in the DMZ..
See if the following helps:
How To: Use Forms Authentication with Active Directory in Multiple Domains i
n ASP.NET 2.0
http://msdn.microsoft.com/library/d... />
000021.asp
Paul
~~~~
Microsoft MVP (Visual Basic)|||I guess, I need to clarify. I do not wish to use Active Directory in anyway
to authenticate my web application users. They will be authenticated off
tables in SQL Server. The problem I am having is making the Asp.Net Web
Application connect to and authenticate against the SQL Server using a
standard specified Windows account. Is there a way to do it when the SQL
server is in a domain environment and the Web Server are in a Workgroup
environment. I have tried SQL Auth and it works fine.
TIA!
"Paul Clement" <UseAdddressAtEndofMessage@.swspectrum.com> wrote in message
news:rh8a4218grgi70ba3tef4td7n80lmcrus5@.
4ax.com...
> On Tue, 18 Apr 2006 09:53:06 -0500, <param@.community.nospam> wrote:
> I would love to use SQL Auth, but the beauty of windows auth is I dont
> have
> to specify the username/pwd in the config file. Is there no way at all
> to
> get this to work? Does MS recommend putting your Web Servers in the same
> domain as the SQL? Our security consultant told us never to do that.
> Leave
> the Web in the DMZ..
>
> See if the following helps:
> How To: Use Forms Authentication with Active Directory in Multiple Domains
> in ASP.NET 2.0
> http://msdn.microsoft.com/library/d...>
ht000021.asp
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)|||<param@.community.nospam> wrote in message
news:uWbzbqxYGHA.1580@.TK2MSFTNGP02.phx.gbl...
>I guess, I need to clarify. I do not wish to use Active Directory in anyway
>to authenticate my web application users. They will be authenticated off
>tables in SQL Server. The problem I am having is making the Asp.Net Web
>Application connect to and authenticate against the SQL Server using a
>standard specified Windows account. Is there a way to do it when the SQL
>server is in a domain environment and the Web Server are in a Workgroup
>environment. I have tried SQL Auth and it works fine.
Right - how do you expect to use Windows Auth if both machines are not in a
domain?
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsser...ty/centers/iis/
http://mvp.support.microsoft.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS|||Marina wrote on Tue, 18 Apr 2006 10:42:07 -0400:

> The problem is that you gave permissions to the domain account, but you
> running it as a local account. The remote SQL Server doesn't know about
> your local 'netasp', it only knows about the domain one. I'm not sure you
> can 'fool' the SQL server in thinking that the local machine account of
> the remote web server is the same thing as the domain account it knows
> about. I think you'd have to make your web server part of the domain, and
> run it under the domain account. That, or just use username/password for
> the the sql server authentication instead of integrated.
By using the same login name and password on both machines it should work -
certainly does here where I have an IIS server running sites under local
accounts that match credentials on a SQL server machine and they login fine,
both servers are configured to run in the same workgroup (no domains running
in my DMZ). I am however doing this using ASP and via ODBC and OLE DB
connections, so it could be that something is different in the way ASP.NET
passes credentials around.
Dan