Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Sunday, March 25, 2012

Connecting to SQL Express on a hosted site

Folks.

I just moved my domain to GoDaddy.com. When I run my website locally, everything works fine.

When I ftp it to my server space on GoDaddy.com, I get a "remote connection" error. Does anyone have an example of a connection string I should be using to connect while on the server?

Thanks!

From looking at their website, they do not appear to offer SQL Server2005 or SQL Server 2005 Express. That'd be why you're getting theerror you are. I'm getting the same dang thing on my hostingservice - 1PlanHost.com. They, for some reason, will not installSQL Express... even though ALL of these starter kits, etc. are using itby default. It's making things quite bothersome for us developers!

If anyone figures out a way to force SQL Express to run within a shared hosting enviroment, let me know!|||

Thanks for your response. GoDaddy does offer SQL Server. You can configure it once you have purchased a hosting package. What they don't offer is any incling of support for it. If I find anything out, I'll let you know.

sqlsql

Monday, March 19, 2012

Connecting to local SQL Server

Hi,

I am having problems connecting to databases on my local SQL Server, express edition from my website.

The following is the connection string i am using:

Database=MyDatabase;Server=COMP\SQLEXPRESS;User ID=sa;

The error I get is "Login failed for sa"

I have tried other users but no luck. Also, I cant seem to create a new user as I don't have administrators rights, any ideas how i can do this?

Any ideas?

did you try it this way

<add name="CommerceTemplate" connectionString="Data Source=Comp.Name\SQLEXPRESS;Initial Catalog=dbname;Trusted_Connection=True;"
providerName="System.Data.SqlClient" />

hope this helps

|||

see

www.connectionstrings.com

for help

|||

Hi,

From your description, it seems that you are using "sa" account to log in your SQLServer, that is to say you have set your SQLServer as "SQL Mixed Authentication mode", right?

Based on the error message, there are two possibilities. First, try to log into your SQLServer by SQLServer Management Studio with the 'sa' account, to see if it can work. If not, I guess the account and password maybe invalid. Second, if you are using Windows Authentication mode, you should also make your connection string looks like:

"data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"

Thanks.

Sunday, March 11, 2012

connecting to asp.net website

I want to connect to a asp.net website...
does any1 know how to connect queries from the database to the website??
Tahttp://www.123aspx.com/directory.aspx?dir=74 & http://www.devarticles.com/c/a/ASP/Two-Ways-To-Connect-To-SQL-Server-2000-Via-ASP/ for your reference.

Saturday, February 25, 2012

Connecting SQL server to the net?

Hi all. Im using Visual Web developer 2005 and have successfully connected my SQL Server to Visual Web developer website. When i run it locally, its fine. But, i now would like the site to be placed on the net - but im not sure how to connect it properly in the webhost. Can someone tell me how this is done please, or a link? cheers.

You can add a connection string on web.config file

<connectionStrings>

<add name="connectioname" connectionString="server=database server;uid=username; pwd=pasword; database=databasename;"/>

</connectionStrings>

then call this connection string on your page.

string strCon = System.Configuration.ConfigurationManager.ConnectionStrings["connectionname"].ConnectionString;

I hope this will help.

|||

Ok.....im still rather confused on how exactly the databse is linked. Firstly, i have the site on a external harddrive....but ive found that the SQL server databse is placed in a totally different location - C:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\Data\Database.mdf

Surely i would have to link it some how for the site/databse to work properly on the site?

|||No ideas guys? Surely there must be a way so i can upload my SQL server database and connect it to my website? I can do it easily in Visual Web Developer in my computer....but stummped how to do it on the net.....|||

Hi,

You may follow the steps below.

First, backup you local database.

Second, get the physical folder of the database file exist on your server. From your previous post, it isC:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\Data\.

Third, restore your backup file to your server database. (Note, you have to replace theMove to Physical file nameitem in the Option tab with your real server-side database folder.)

Third, modify the connection string in your web.config file and call the string in your code by ConfigurationManager.

Thanks.

Connecting Sql Server 2005 from ASP?

Hi
We are planning to move over to SQL Server 2005 in near future.

At the moment Website is on a seperate server then the Database.
OS for both the server is Window 2003 and currently our data is on SQL
Server 2000(on which everything works fine).

Part of the testing process we tried to connect our website on SQL 2005
and it does not work at all.

I get this

-
ADODB.Connection error '800a0e7a'
Provider cannot be found. It may not be properly installed.

When i use following connection string
"Provider=SQLNCLI;Server=127.0.0.1;Database=dbName;UID=UserName;PWD=UserPassword;"

(Above string has fixed problem for few people- googled it, but not for
me.)
-

-
This is the message i get for all the following connectiong string

Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.

1) - "Provider=SQLOLEDB.1;Password=UserPassword;Persist Security
Info=True;User ID=UserName;Initial Catalog=ABC;Data
Source=XXX.XX.X.XX,1433"

2) - "Provider=sqloledb;Data Source=XXX.XX.X.XX,1433;Network
Library=DBMSSOCN;Initial Catalog=ABC;User
ID=UserName;Password=UserPassword"

3) - "Provider=SQLOLEDB.1;Persist Security Info=True;User
ID=UserName;Initial Catalog=ABC;Data Source = ServerName\SQLInstance"

-

I tried connecting to SQL Server 2005 through our system developed in
VB.Net 2003 and it works fine and here is the Connection String :

"Data Source=ServerName\SQLInstance;Initial Catalog=ABC;Persist
Security Info=False;user id=UserName;password=UserPassword"

Then i downloaded SQL Native Client and installed on the web server.

I looked in SAC Tool and "Local and Remote Connection" and "Using Both
TCP/IP and Named Pipes" options are selected. I have checked SQL
Browser service is running.

Now when i use this string

"Provider=SQLNCLI;Server=127.0.0.1;Database=DBName;UID=UserName;PWD=UserPassword;"

i get

Microsoft SQL Native Client error '80040e4d'

Login failed for user 'UserName'.

I have created this user and this user has proper permission to access
the database i need.

I would really appreciate any help as this is driving me crazy.

Mits

ASP has not been supported for some time. However, if you're stuck with legacy ASP code, I would expect you'd be able to connect, as it just connects via COM, I thought.

However, web development questions are off topic here. www.asp.net is the place for ASP.NET questions, but as I said, there is no support for asp, and no Microsoft website that allows asp questions. I percieve that the question relates to connecting to SQL Server 2005, which is on topic here, so I'm not locking the thread or marking it as off topic ( which I'd usually do for ASP questions ), but certainly the odds of people here using ASP are very low, so I'd recommend finding a forum that actually supports ASP and asking there. If you're using ASP.NET, and that's what you meant to say, please ask at www.asp.net.

Good luck !!!

|||hi cgraus
Thanks for not locking the topic.

I have never come across anywhere, where its says i cant connect to SQL Server 2005 using ASP. If this is true then that means we can't move on to SQL Server 2005 as all our website still written in ASP and the database is SQL Server 2000.

Mits

|||

// If this is true then that means we can't move on to SQL Server 2005

Well, I guess the real question is, why do you want to ? I mean, your website is ( sorry ) written in a hopelessly out of date technology, so how will SS2005 help you anyhow ? It's not like you can write .NET code to run in it...

But, and this is my core point, I don't know if it's true or not. I've not worked on ASP sites for years, and the odds of me doing it again are zero. That's why you'd be better off finding a site that suports ASP, because it's very much legacy technology now, and unless you're talking to people who are using it, the odds of you getting an answer are pretty low.

|||I understand your point about ASP and getting the answer or solution in this forum.
I will really appreciate if you can give me any link to Microsoft's website where it says that any website written in ASP won't be supported by SS2005.

Mits

|||What i am asking here or atleast tyring to get the answer is;

As it is possible to connect to SQL 2000 using ASP code, Is it still possible to do with SQL Server 2005?

Mits

|||

I don't know, and that's the core point I'm trying to make. If I had a link, I'd have answered your question, but the fact is that it's unlikely that anyone here uses asp, and so it's unlikely that anyone here can help you.

It's unfortunate that it's very hard to google for asp and not asp.net info. -net actually doesn't work, I've discovered.

You didn't answer my question tho - why do you need SQL Server 2005 ? What does it offer to make it worth the cost and the hassle ? I assume you have a huge site, to not be updating it to ASP.NET, but without .NET, what does SQL Server 2005 offer that's so important ?

|||Its a management decision and i am asked to evaluate SS2005 in our business environment.
Based on my findings management will take decision when to migrate over SS2005. Our website are E-Commerce sites and because of lack of resources the tranisition process from ASP to ASP.Net is slow.

I know this is not the place but in line of this discussion, as a MVP what factors would you consider if you want to migrate to SS2005. (Sorry i was just asking cgraus but if anyone wants to throw any ideas then they are more then welcome to do so.)

Mits

|||moved this post to SQL Server getting started.|||

My core criteria with any upgrade is 'what does it give me'. For example, I have projects written in VC6. I don't like VC6, not one bit. But, I don't upgrade my projects to VC2005, or even VC2002, unless I can see a compelling reason to. ANY upgrade to a new product is in essence a move to a new programming language. I would be surprised in T-SQL 2005 changes anything that would stop T-SQL 2000 code from working, but it's still an identifiable risk that I would not take unless there were actual SS205 features that I needed. SQL Server is also not cheap. It's not money I would spend if my SS2000 database was performing just fine, and all I intended to do was run the exact same database on a new engine. The exciting new stuff in SS2005 relate to managed code, and unless you're moving to ASP.NET and intend to use those features ( for good reason, not just to say you did ), I wouldn't bother thinking about moving.

|||hi

Good News guys got it all working.
I really appreciate all the effort and time put in by cgraus .

These are the steps i did, and i dont it might help anyone out there.

Our Webserver is outside DMZ on our network. It can only communicate
through secured channels on our linux firewall. I have got a named
Instance of SQL Server 2005(Enterprise Edition)

1) I punched a hole through our firewall that will allow communication
between our Webserver and DB server through specific Port.
2) I Installed SQL Native Client on Webserver.
3) In SSCM(SQL Server Configuration Manager) Tool
On Console Pane, Click Protocols for <Instance Name>
Double Click TCP/IP
Listen To All > No

For IP1
Active = Yes
Enabled = Yes
IP Address = IP of the DB Server
TCP = Blank/Nothing
TCP Port = 1433( or any port number but it has to be the same that
you have defined in firewall)

Save Everything and Re-start the SQL Server (Instance Name) Service.

This is the example of connection string that worked

Provider=SQLNCLI.1;Persist Security Info=False;User
ID=UserNamer;Password=UserPassword;Initial Catalog=NameofDatabase;Data
Source=DBServerName

Mits

Connecting Sql Server 2005 from ASP?

Hi
We are planning to move over to SQL Server 2005 in near future.

At the moment Website is on a seperate server then the Database.
OS for both the server is Window 2003 and currently our data is on SQL
Server 2000(on which everything works fine).

Part of the testing process we tried to connect our website on SQL 2005
and it does not work at all.

I get this

--------------------
ADODB.Connection error '800a0e7a'
Provider cannot be found. It may not be properly installed.

When i use following connection string
"Provider=SQLNCLI;Server=127.0.0.1;Database=dbName; UID=UserName;PWD=UserPassword;"

(Above string has fixed problem for few people- googled it, but not for
me.)
--------------------

--------------------
This is the message i get for all the following connectiong string

Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
access denied.

1) - "Provider=SQLOLEDB.1;Password=UserPassword;Persist Security
Info=True;User ID=UserName;Initial Catalog=ABC;Data
Source=XXX.XX.X.XX,1433"

2) - "Provider=sqloledb;Data Source=XXX.XX.X.XX,1433;Network
Library=DBMSSOCN;Initial Catalog=ABC;User
ID=UserName;Password=UserPassword"

3) - "Provider=SQLOLEDB.1;Persist Security Info=True;User
ID=UserName;Initial Catalog=ABC;Data Source = ServerName\SQLInstance"

--------------------

I tried connecting to SQL Server 2005 through our system developed in
VB.Net 2003 and it works fine and here is the Connection String :

"Data Source=ServerName\SQLInstance;Initial Catalog=ABC;Persist
Security Info=False;user id=UserName;password=UserPassword"

I would really appreciate any help.

Mits(MVChauhan@.googlemail.com) writes:
> We are planning to move over to SQL Server 2005 in near future.
> At the moment Website is on a seperate server then the Database.
> OS for both the server is Window 2003 and currently our data is on SQL
> Server 2000(on which everything works fine).
>
> Part of the testing process we tried to connect our website on SQL 2005
> and it does not work at all.
> I get this
> --------------------
> ADODB.Connection error '800a0e7a'
> Provider cannot be found. It may not be properly installed.
> When i use following connection string
> "Provider=SQLNCLI;Server=127.0.0.1;

Did you install SQL Native Client on the web server? SQL Native Client
is a DLL that contains versions of both the ODBC SQL Server Driver
and the SQL Server OLE DB Provider that has been enhanced with support
for SQL 2005.

SQL Native Client is freely distributable.

> This is the message i get for all the following connectiong string
> Microsoft OLE DB Provider for SQL Server error '80004005'
> [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
> access denied.

Note that by default some editions of SQL 2005 by default only permits
local connections. You can modify this in the Surface Area Configuration
Tool.

You may also have to encure that the SQL Browser service is running.

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi Erland
Thanks for your reply.
I still cant conntect to SQL Server.

I downloaded SQL Native Client and installed on the web server.

I looked in SAC Tool and "Local and Remote Connection" and "Using Both
TCP/IP and Named Pipes" options are selected. I have checked SQL
Browser service is running.

Now when i use this string

"Provider=SQLNCLI;Server=127.0.0.1;Database=DBName; UID=UserName;PWD=UserPassword;"

i get

Microsoft SQL Native Client error '80040e4d'

Login failed for user 'UserName'.

I have created this user and this user has proper permission to access
the database i need.
Is there any special permissions that need? This is driving me crazy.

Mits

You may also have to encure that the SQL Browser service is running.

Erland Sommarskog wrote:

> (MVChauhan@.googlemail.com) writes:
> > We are planning to move over to SQL Server 2005 in near future.
> > At the moment Website is on a seperate server then the Database.
> > OS for both the server is Window 2003 and currently our data is on SQL
> > Server 2000(on which everything works fine).
> > Part of the testing process we tried to connect our website on SQL 2005
> > and it does not work at all.
> > I get this
> > --------------------
> > ADODB.Connection error '800a0e7a'
> > Provider cannot be found. It may not be properly installed.
> > When i use following connection string
> > "Provider=SQLNCLI;Server=127.0.0.1;
> Did you install SQL Native Client on the web server? SQL Native Client
> is a DLL that contains versions of both the ODBC SQL Server Driver
> and the SQL Server OLE DB Provider that has been enhanced with support
> for SQL 2005.
> SQL Native Client is freely distributable.
> > This is the message i get for all the following connectiong string
> > Microsoft OLE DB Provider for SQL Server error '80004005'
> > [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
> > access denied.
> Note that by default some editions of SQL 2005 by default only permits
> local connections. You can modify this in the Surface Area Configuration
> Tool.
> You may also have to encure that the SQL Browser service is running.
>
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx|||The SQL 2005 password is case sensitive while 2000 wasn't, so code that
works on SQL 2000 for logging in may not work on 2005.

MVChauhan@.googlemail.com wrote:
> Hi Erland
> Thanks for your reply.
> I still cant conntect to SQL Server.
> I downloaded SQL Native Client and installed on the web server.
> I looked in SAC Tool and "Local and Remote Connection" and "Using Both
> TCP/IP and Named Pipes" options are selected. I have checked SQL
> Browser service is running.
> Now when i use this string
> "Provider=SQLNCLI;Server=127.0.0.1;Database=DBName; UID=UserName;PWD=UserPassword;"
> i get
> Microsoft SQL Native Client error '80040e4d'
> Login failed for user 'UserName'.
> I have created this user and this user has proper permission to access
> the database i need.
> Is there any special permissions that need? This is driving me crazy.
>
> Mits
>
>
>
> You may also have to encure that the SQL Browser service is running.
> Erland Sommarskog wrote:
> > (MVChauhan@.googlemail.com) writes:
> > > We are planning to move over to SQL Server 2005 in near future.
> > > > At the moment Website is on a seperate server then the Database.
> > > OS for both the server is Window 2003 and currently our data is on SQL
> > > Server 2000(on which everything works fine).
> > > > > Part of the testing process we tried to connect our website on SQL 2005
> > > and it does not work at all.
> > > > I get this
> > > > --------------------
> > > ADODB.Connection error '800a0e7a'
> > > Provider cannot be found. It may not be properly installed.
> > > > When i use following connection string
> > > "Provider=SQLNCLI;Server=127.0.0.1;
> > Did you install SQL Native Client on the web server? SQL Native Client
> > is a DLL that contains versions of both the ODBC SQL Server Driver
> > and the SQL Server OLE DB Provider that has been enhanced with support
> > for SQL 2005.
> > SQL Native Client is freely distributable.
> > > This is the message i get for all the following connectiong string
> > > > Microsoft OLE DB Provider for SQL Server error '80004005'
> > > > [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
> > > access denied.
> > Note that by default some editions of SQL 2005 by default only permits
> > local connections. You can modify this in the Surface Area Configuration
> > Tool.
> > You may also have to encure that the SQL Browser service is running.
> > --
> > Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> > Books Online for SQL Server 2005 at
> > http://www.microsoft.com/technet/pr...oads/books.mspx
> > Books Online for SQL Server 2000 at
> > http://www.microsoft.com/sql/prodin...ions/books.mspx|||I know there is no issue with Password.
I just realised one thing i dont know if it matters..
Between our webserver there is a firewall, do we need to punch a hole
that will allow communication between our webserver and DB Server.

Mits

pb648174 wrote:

> The SQL 2005 password is case sensitive while 2000 wasn't, so code that
> works on SQL 2000 for logging in may not work on 2005.
> MVChauhan@.googlemail.com wrote:
> > Hi Erland
> > Thanks for your reply.
> > I still cant conntect to SQL Server.
> > I downloaded SQL Native Client and installed on the web server.
> > I looked in SAC Tool and "Local and Remote Connection" and "Using Both
> > TCP/IP and Named Pipes" options are selected. I have checked SQL
> > Browser service is running.
> > Now when i use this string
> > "Provider=SQLNCLI;Server=127.0.0.1;Database=DBName; UID=UserName;PWD=UserPassword;"
> > i get
> > Microsoft SQL Native Client error '80040e4d'
> > Login failed for user 'UserName'.
> > I have created this user and this user has proper permission to access
> > the database i need.
> > Is there any special permissions that need? This is driving me crazy.
> > Mits
> > You may also have to encure that the SQL Browser service is running.
> > Erland Sommarskog wrote:
> > > (MVChauhan@.googlemail.com) writes:
> > > > We are planning to move over to SQL Server 2005 in near future.
> > > > > > At the moment Website is on a seperate server then the Database.
> > > > OS for both the server is Window 2003 and currently our data is on SQL
> > > > Server 2000(on which everything works fine).
> > > > > > > > Part of the testing process we tried to connect our website on SQL 2005
> > > > and it does not work at all.
> > > > > > I get this
> > > > > > --------------------
> > > > ADODB.Connection error '800a0e7a'
> > > > Provider cannot be found. It may not be properly installed.
> > > > > > When i use following connection string
> > > > "Provider=SQLNCLI;Server=127.0.0.1;
> > > > Did you install SQL Native Client on the web server? SQL Native Client
> > > is a DLL that contains versions of both the ODBC SQL Server Driver
> > > and the SQL Server OLE DB Provider that has been enhanced with support
> > > for SQL 2005.
> > > > SQL Native Client is freely distributable.
> > > > > This is the message i get for all the following connectiong string
> > > > > > Microsoft OLE DB Provider for SQL Server error '80004005'
> > > > > > [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or
> > > > access denied.
> > > > Note that by default some editions of SQL 2005 by default only permits
> > > local connections. You can modify this in the Surface Area Configuration
> > > Tool.
> > > > You may also have to encure that the SQL Browser service is running.
> > > > > > > --
> > > Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> > > > Books Online for SQL Server 2005 at
> > > http://www.microsoft.com/technet/pr...oads/books.mspx
> > > Books Online for SQL Server 2000 at
> > > http://www.microsoft.com/sql/prodin...ions/books.mspx|||MVChauhan@.googlemail.com (MVChauhan@.googlemail.com) writes:
> Thanks for your reply.
> I still cant conntect to SQL Server.
> I downloaded SQL Native Client and installed on the web server.
> I looked in SAC Tool and "Local and Remote Connection" and "Using Both
> TCP/IP and Named Pipes" options are selected. I have checked SQL
> Browser service is running.
> Now when i use this string
>
"Provider=SQLNCLI;Server=127.0.0.1;Database=DBName; UID=UserName;PWD=UserPass
word;"
> i get
> Microsoft SQL Native Client error '80040e4d'
> Login failed for user 'UserName'.

This is strange, because as I understood your original post, you were
connecting from a web server that was a on different machine from where
SQL Server is running.

However, in your connection string you have specified 127.0.0.1 which is
always the local machine. Still, you do make contact with an SQL Server
instance since you get that message.

Since I don't see your configuration, I'm left to guessworks, but there
are two obvious possibilities:
1) You have the username/password wrong.
2) You have an of SQL Server on the web server as well, but that's
not the one you intend to connect to.

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||hi Erland

I am sorry if i confued you, you are right WebServer and DB Server are
2 different machines. I have replaced 127.0.0.1 with the IP of DB
server and now the error is

TCP Provider: An existing connection was forcibly closed by the remote
host.

Configuration of Servers are as follows

Webserver
OS Windows 2003

Database Server
OS Windows 2003
DB SQL Server 2005 with Service Pack1

Mits

Erland Sommarskog wrote:

> MVChauhan@.googlemail.com (MVChauhan@.googlemail.com) writes:
> > Thanks for your reply.
> > I still cant conntect to SQL Server.
> > I downloaded SQL Native Client and installed on the web server.
> > I looked in SAC Tool and "Local and Remote Connection" and "Using Both
> > TCP/IP and Named Pipes" options are selected. I have checked SQL
> > Browser service is running.
> > Now when i use this string
> "Provider=SQLNCLI;Server=127.0.0.1;Database=DBName; UID=UserName;PWD=UserPass
> word;"
> > i get
> > Microsoft SQL Native Client error '80040e4d'
> > Login failed for user 'UserName'.
> This is strange, because as I understood your original post, you were
> connecting from a web server that was a on different machine from where
> SQL Server is running.
> However, in your connection string you have specified 127.0.0.1 which is
> always the local machine. Still, you do make contact with an SQL Server
> instance since you get that message.
> Since I don't see your configuration, I'm left to guessworks, but there
> are two obvious possibilities:
> 1) You have the username/password wrong.
> 2) You have an of SQL Server on the web server as well, but that's
> not the one you intend to connect to.
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx|||MVChauhan@.googlemail.com (MVChauhan@.googlemail.com) writes:
> I am sorry if i confued you, you are right WebServer and DB Server are
> 2 different machines. I have replaced 127.0.0.1 with the IP of DB
> server and now the error is
> TCP Provider: An existing connection was forcibly closed by the remote
> host.
> Configuration of Servers are as follows
> Webserver
> OS Windows 2003
> Database Server
> OS Windows 2003
> DB SQL Server 2005 with Service Pack1

Have you configured SQL 2005 to accept remote connections? The Developer
and Express Editions of SQL 2005 accepts by default local connection only.

Use the Surface Area Configuration tool to check and change this.

Also make sure that the SQL Server Browser service is running.

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||In SAC I have enabled Local and Remote Connection and also SQL Browser
service is running and is also Active.

Mits

Erland Sommarskog wrote:

> MVChauhan@.googlemail.com (MVChauhan@.googlemail.com) writes:
> > I am sorry if i confued you, you are right WebServer and DB Server are
> > 2 different machines. I have replaced 127.0.0.1 with the IP of DB
> > server and now the error is
> > TCP Provider: An existing connection was forcibly closed by the remote
> > host.
> > Configuration of Servers are as follows
> > Webserver
> > OS Windows 2003
> > Database Server
> > OS Windows 2003
> > DB SQL Server 2005 with Service Pack1
>
> Have you configured SQL 2005 to accept remote connections? The Developer
> and Express Editions of SQL 2005 accepts by default local connection only.
> Use the Surface Area Configuration tool to check and change this.
> Also make sure that the SQL Server Browser service is running.
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx|||MVChauhan@.googlemail.com (MVChauhan@.googlemail.com) writes:
> In SAC I have enabled Local and Remote Connection and also SQL Browser
> service is running and is also Active.

And you did restart SQL Server after enabling remote connections?

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

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Good News guys got it all working.
I really appreciate all the effort and time put in by Erland .

These are the steps i did, and i dont it might help anyone out there.

Our Webserver is outside DMZ on our network. It can only communicate
through secured channels on our linux firewall. I have got a named
Instance of SQL Server 2005(Enterprise Edition)

1) I punched a hole through our firewall that will allow communication
between our Webserver and DB server through specific Port.
2) I Installed SQL Native Client on Webserver.
3) In SSCM(SQL Server Configuration Manager) Tool
On Console Pane, Click Protocols for <Instance Name>
Double Click TCP/IP
Listen To All --> No

For IP1
Active = Yes
Enabled = Yes
IP Address = IP of the DB Server
TCP = Blank/Nothing
TCP Port = 1433( or any port number but it has to be the same that
you have defined in firewall)

Save Everything and Re-start the SQL Server (Instance Name) Service.

This is the example of connection string that worked

Provider=SQLNCLI.1;Persist Security Info=False;User
ID=UserNamer;Password=UserPassword;Initial Catalog=NameofDatabase;Data
Source=DBServerName

Mits

Erland Sommarskog wrote:

> MVChauhan@.googlemail.com (MVChauhan@.googlemail.com) writes:
> > In SAC I have enabled Local and Remote Connection and also SQL Browser
> > service is running and is also Active.
> And you did restart SQL Server after enabling remote connections?
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx

Connecting sql db to an html website

Does anyone know a good site that has a tutorial? I want to be able to input data from the website straight to the db i.e. place orders, check status of order.There are hundreds of web sites like this, each catering to a specific web site configuration. The methods for accessing the datsbase are different for ASP, COLDFUSION, PHP, etc.

-PatP|||I was looking through the forum posts and the closest thing I could find was a link between asp and sql. I do not know asp, but was wondering if there was one for just a regular html website.|||straight from the html to the database? not possible

has to be done using some type of server side program, generally called "cgi" (common gateway interface or something like that)

asp is a type of cgi program, so is perl, coldfusion, jsp, php, et cetera|||Do you know of a beginners guide to using this? Php I'm a little familiar with and thought of a solution to take a mssql db and importing it into a mysql sb; only problem with that is having a php script that will run it

Friday, February 24, 2012

Connecting OSQL to MSDE using Windows NT Authentication?

I am installing MSDE SP3a on an NT 4.0 server and experiencing the
'CryptoAPI failed' error.
Now I found the error solution on the MS website, but this requires using
osql and connecting using Windows NT Authentication.
I have installed using SQL securitymode. Will this prevent me from
connecting using Windows NT Auth..?
If so, how can reset the securitymode to SQL after I have installed and
applied the correction for the original issue?
I am logged onto the NT server using the ADMINISTRATOR id, can I start OSQL
without the -U and -P parms?
Does the ADMINISTRATOR id require any additional permissions to connect to
MSDE? The reason I ask is because the MS document specifies "Make sure to
use Windows NT Authication while you are logged on with a Windows NT Account
that is a member of the SQL Server sysadmin role".
Install parms:
MSDERelA\setup.exe DATADIR=^sDataDrive"^ DISABLENETWORKPROTOCOLS=0
INSTANCENAME=XXXXX SAPWD=SA_pwd SECURITYMODE=SQL TARGETDIR=^sDataDrive^ /L*v
^sDataDrive XXXXX.log^ /qb
Thanks for any/all help..
Jim K.
This is mixed Authentication, so Windows Authentication should work, if
you are a local administrator try using the -E switch with OSQL. OSQL
-E which connects to the local server with the Windows credentials.
HTH, Jens Suessmeyer.

Sunday, February 12, 2012

Connect to SQL Server using Integrated Security=true

Hi all,
I use the following connectionstring connect to sqlserv
server=(local); database=mydata;Integrated Security=true
If I tried browse the website in VS Web Developer 2005 environment, it's ok. After I compiled the site and access through IIS server, can not connect to sqlserver , I need to use login and password to connect. How can I connect wihtout using LogID and password.

Thanks

You should change your database connection code like this,and it works well

SqlConnection myConnection =new SqlConnection("Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Sample;");

myConnection.Open();

|||

taoge:

Hi all,
I use the following connectionstring connect to sqlserv
server=(local); database=mydata;Integrated Security=true
If I tried browse the website in VS Web Developer 2005 environment, it's ok. After I compiled the site and access through IIS server, can not connect to sqlserver , I need to use login and password to connect. How can I connect wihtout using LogID and password.

Thanks


What's the error message? If it is something like 'Login failed for user xxx/ASPNET...', you can take a look at this post:

http://forums.asp.net/thread/1356875.aspx

Connect to sql server from asp.net web app

Hi,
I have a website on a dedicated web server that can't communicate with a sql server 2000 database sitting behind a firewall. My website is written in asp.net 2 and c# 2 and port 1433 has been opened through the firewall to allow access. On the db server is an admin database set up to use asp.net authentication. I am running Visual Web Dev 2005 Express on the web server to test the application and initially I want to connect to that db and set up my app and asp 'admin' users. For that I would normally use the 'Website/ ASP.NET Configuration' menu option within the IDE. At the moment I just get a connection error:

Server Error in '/asp.netwebadminfiles' Application.

------------------------

Access is denied.

Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.

Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.

------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Server Error in '/asp.netwebadminfiles' Application.

------------------------

Access is denied.

Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.

Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.

------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Now which server is the problem on - the web server?? What do I need to do to connect with this db? Help! Thanks in advance.

Chris

Look at the IIS logs to see what request generated the 401.2 result code.

Jeff

Friday, February 10, 2012

connect to SQL db on website ? (+ send email)

1. If I wanted to send email based on polling of data held in an SQL db
hosted on a website, what would be the best way to do it?
(i.e purchase a dedicated server, write and install a service and get the
service to send to ISP's SMTP server ?)
2. If I wanted to connect to an SQL DB hosted on a website what would be the
best way ?
(open port and connect over SSL ?)
Thanks for any information
ScottScott,
Here is a simple function I wrote to send email in VB.NET. You were not
specific to any programming language.
Private Sub SendEmail(ByVal Path As String, Optional ByVal Body As
String = "", Optional ByVal Too As String = "default@.default.com")
Dim SendMessage As New SmtpClient
Dim Message As MailMessage = New
MailMessage("from@.somewhere.com", Too, "Foo", Body)
Dim App As Attachment
If Path.Length > 0 And File.Exists(Path) Then
App = New Attachment(Path)
Message.Attachments.Add(App)
End If
SendMessage.Host = "" 'ServerName or IP Address of SMTP Server
goes here.
SendMessage.Send(Message)
End Sub
This function was created in VS 2005 using the .net framework 2.0

connect to SQL db on website ? (+ send email)

1. If I wanted to send email based on polling of data held in an SQL db
hosted on a website, what would be the best way to do it?
(i.e purchase a dedicated server, write and install a service and get the
service to send to ISP's SMTP server ?)
2. If I wanted to connect to an SQL DB hosted on a website what would be the
best way ?
(open port and connect over SSL ?)
Thanks for any information
ScottScott,
Here is a simple function I wrote to send email in VB.NET. You were not
specific to any programming language.
Private Sub SendEmail(ByVal Path As String, Optional ByVal Body As
String = "", Optional ByVal Too As String = "default@.default.com")
Dim SendMessage As New SmtpClient
Dim Message As MailMessage = New
MailMessage("from@.somewhere.com", Too, "Foo", Body)
Dim App As Attachment
If Path.Length > 0 And File.Exists(Path) Then
App = New Attachment(Path)
Message.Attachments.Add(App)
End If
SendMessage.Host = "" 'ServerName or IP Address of SMTP Server
goes here.
SendMessage.Send(Message)
End Sub
This function was created in VS 2005 using the .net framework 2.0