Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Tuesday, March 27, 2012

Connecting to sql server 2005

I want to connect to database using sql server 2005 through Visual web developer 2005 express edition . what will be the connection string for this....

keywords under * * are for your own variable.

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ *datafile name *.mdf;Integrated Security=True;User Instance=True"

if it is a database in a local drive

and if you are using a web server ,

connectionString="data source=*ip address * ;user id=userid;password=pass"

|||

The following link might help you..

http://www.connectionstrings.com/?carrier=sqlserver2005

|||

sagar Khatri wrote:

keywords under * * are for your own variable.

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ *datafile name *.mdf;Integrated Security=True;User Instance=True"

if it is a database in a local drive

In fact that is not the right explanation. The above mentioned syntax is used when you use the SQL Server 2005 Express feature of user instances. The above mentioned sample assumes that yxou have a local SQL Server Express instance (configured with the instance name of SQLEXPRESS). User instances are used to temporary attach datafile to SQL Server instances.

sagar Khatri wrote:

and if you are using a web server ,

connectionString="data source=*ip address * ;user id=userid;password=pass"

This has nothing to do with a web server. The above mentioned syntax is used when you have a SQL Server attached database. No matter which middle tier (either an application you wrote or a web server is connecting to the database server)=, you are able to have multiple conenctions from multiple applications to this database, other then the user instance where only one application can create a user instance and have access to the database at a time.

Jens K. Suessmeyer

http://www.sqlserver2005.de

sqlsql

connecting to sql server 2000 from sql server 2005 management studio

My web site is hosted by a third party, and the back-end is a sql server 2000 database. I was routinely running queries over the internet against the database using Query Analyzer. I just installed sql server 2005. Is it possible to run a sql query against a table in the sql server 2000 database from within sql server 2005 management studio? I haven't found anything in the docs explaining how to connect to sql server 2000. Any help would be appreciated.

You can just connect to the SQL Server 200 as you connected before and are connecting now with your Business Management Studio. Its downwards compatible.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||Hi there,

If all you want to do is access your SQL Server 2000 database using SQL Server 2005 Management Studio then you just need to add another connection in your Object Explorer. I believe the steps are:

1) Go File > Connect Object Explorer (NB. alternately you can click on the "Connect Object Explorer" button in the Object Explorer window

2) A dialog will appear where you specify the server name, auth type (SQL Server, Windows), username and password.

Enter the server name (should be the same as the name of the server you connect to in Query Analyzer) and other details as appropriate (the same config you used in Query Analyzer should apply here).

3) A node for your SQL Server 2000 server should appear in the Object Explorer. To query against the database, an easy way is to click on the database (you'll need to expand a few nodes in Obejct Explorer) and then click the "New Query" button (or go File > New > Query With Current Connection).

If your intent is to have your SQL Server 2005 database and define queries for that database that reference the SQL Server 2000 database then you'll need to define a linked server from the SQL Server 2005 instance to the SQL Server 2000 instance. There should be details on how to do this in Books Online.

Hope that helps a bit but sorry if it doesn't & I've missed the mark completely.

Connecting to SQL Server & XP Service Pack 2

I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
running on it prior to the install. I have a C# web application that runs
against a local SQL Server database which I cannot get to work now that I
have installed the XP service pack. I have read all of the Microsoft "HOW To"
documents about configuring SQL Server for the Service Pack but I still
cannot get the Web Appliation to communicate with the database. I always get
the "SQL Server does not exist or access denied." error message. I have tried
the following:
1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
static port SQL Server is using)
2. Added Port 445 (TCP/IP) to the Firewall Exception List
3. Added the sqlserver.exe file to the Firewall Exception List
The database connection string I am using in the web application is:
server=local;uid=sa;pwd=<password>;database=Resear ch
At this point I am not sure what else to try. I cannot connect to the
database if the Firewall is turned off. Should this be the case? Any
assistance is much appreciated.
Sincerely,
Tom Hessen
Hi Tom,
I had the same problem and decided to look at the other end of the
connection. I was running SQL Server ( Service Pack 2 ). When I upgraded
to SQL Server ( Service Pack 3a ) everything started working again.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Resear ch
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen
|||Hi Tom,
I've had a little trouble posting, but hopefully this will get through.
I also did everything you listed below. It did not work for me
either ( for a java client ).
I then decided to look at the other end of the connection. I was running
SQLServer ( Service Pack 2 ). When I upgraded to SQLServer ( Service Pack
3a ) everything started working again.
Hope this helps,
Mike S.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Resear ch
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen
sqlsql

Connecting to SQL Server & XP Service Pack 2

I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
running on it prior to the install. I have a C# web application that runs
against a local SQL Server database which I cannot get to work now that I
have installed the XP service pack. I have read all of the Microsoft "HOW To"
documents about configuring SQL Server for the Service Pack but I still
cannot get the Web Appliation to communicate with the database. I always get
the "SQL Server does not exist or access denied." error message. I have tried
the following:
1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
static port SQL Server is using)
2. Added Port 445 (TCP/IP) to the Firewall Exception List
3. Added the sqlserver.exe file to the Firewall Exception List
The database connection string I am using in the web application is:
server=local;uid=sa;pwd=<password>;database=Research
At this point I am not sure what else to try. I cannot connect to the
database if the Firewall is turned off. Should this be the case? Any
assistance is much appreciated.
Sincerely,
Tom HessenHi Tom,
I had the same problem and decided to look at the other end of the
connection. I was running SQL Server ( Service Pack 2 ). When I upgraded
to SQL Server ( Service Pack 3a ) everything started working again.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Research
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen|||Hi Tom,
I've had a little trouble posting, but hopefully this will get through.
I also did everything you listed below. It did not work for me
either ( for a java client ).
I then decided to look at the other end of the connection. I was running
SQLServer ( Service Pack 2 ). When I upgraded to SQLServer ( Service Pack
3a ) everything started working again.
Hope this helps,
Mike S.
"Tom Hessen" <Tom Hessen@.discussions.microsoft.com> wrote in message news:<645A76F5-D701-4411-9720-1C6AC67A7ED5@.microsoft.com>...
> I installed XP Service Pack 2 on my desktop machine which had SQL Server 2000
> running on it prior to the install. I have a C# web application that runs
> against a local SQL Server database which I cannot get to work now that I
> have installed the XP service pack. I have read all of the Microsoft "HOW To"
> documents about configuring SQL Server for the Service Pack but I still
> cannot get the Web Appliation to communicate with the database. I always get
> the "SQL Server does not exist or access denied." error message. I have tried
> the following:
> 1. Added Port 1433 (TCP/IP) to the Firewall Exception List (1433 is the
> static port SQL Server is using)
> 2. Added Port 445 (TCP/IP) to the Firewall Exception List
> 3. Added the sqlserver.exe file to the Firewall Exception List
> The database connection string I am using in the web application is:
> server=local;uid=sa;pwd=<password>;database=Research
> At this point I am not sure what else to try. I cannot connect to the
> database if the Firewall is turned off. Should this be the case? Any
> assistance is much appreciated.
> Sincerely,
> Tom Hessen

Connecting to SQL server

Hi

i'm having lots of problems connecting my application to a database. I'm using Visual Web developer 2008 (coding in VB) and trying to connect to a locally installed version SQL server Express.

what i'm trying to do is using a DropDownList box get a user to select a name. This will then automaticly run a SQL query to pull data out of the DB and into a GridView. i'm coding (in VB only) everything under the DropDownList.SelectedIndexChanged section.


the query i want to run is -

SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @.owner_id)

The owner_id field references another table (owner). Therefore i run the inner query to get the owner_id based on the selected name in the dropDownlist, then let the outer query pull out all tasks which match the result from the inner query.

my code at the moment is

Dim dsAsNew DataSet

Dim myconnectionAs SqlConnection'create a connection

'create connection to DB

myconnection.ConnectionString ="server=localhost;database=taskDB"

'create the sql command

Dim objcmdAsNew SqlCommand("SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @.owner_id)))", myconnection)

objcmd.Connection.Open()

'open the connection to DB

Dim objreaderAs SqlDataReader = objcmd.ExecuteReader

Dim daAsNew SqlDataAdapter

da.SelectCommand = objcmd

'fails here sql not allowing remote connection

da.Fill(ds)

Me.GridView1.DataSource = da

Me.GridView1.DataBind()

'close the connection to the DB

objcmd.Connection.Close()

The application fails when you select a name from the drop down box.

fails at - myconnection.ConnectionString ="server=localhost;database=taskDB"Error is "Object reference not set to an instance of an object." If i comment out this line, i get the same error but at it stopps at the objcmd.connection.open(). Strange.

Can anyone tell me what i am doing wrong? Have i setup the connection to the DB ok?

Thanks

Cj

You to use the keyword New when creating an object of class SqlConnection.

Dim myconnectionAs New SqlConnection

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx

Also, the connection string to the database doesn't seem to be right. Have a look at this and try modifying your connection string:

http://www.connectionstrings.com/?carrier=sqlserver2005

connecting to sql server

Dear Sirs,
I am working on my first sql server web application. I have read many documents and I have gone to many forums, but i have'nt found any answer. Can you help me please.
Here is my problem:
I can't connect to my database. I use windows authentication and i log in as administrator. I have installed home edition of sql server and IIS is installed in my computer. I use this scripts:

<%
dim objCon
set objCon = server.CreateObject("ADODB.Connection")
objCon.ConnectionString="DSN=dbna.dsn;uid=sa;pwd=;database=na2"
objCon.open
%>

Where dbna.dsn have been defined in "Data Sources (ODBC)" part of control panel.
When I open the my webpage i receive this error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'ALADDIN\IUSR_ALADDIN'.
/dbconnect.asp, line 5

My computer name is ALADDIN and my username is Omid.
Best regards,
Omid.SQL thinks that you are trying to connect using windows authentication. Check the settings on your DSN entry.

As an aside, I would avoid using a DSN entry if you can. Instead, use MS OLE DB for SQL Server.

Check out this web site for some good examples: www.connectionstrings.com.

Regards,

hmscott|||Also, Carl Prothman's Connection String Site (http://www.carlprothman.net/Default.aspx?tabid=81) is pretty handy.|||Thanks alot for your helps but I can't connect to my database yet. I tried OLE DB too but I received the same error. I think something is wrong in my sql server. Can you tell me please what are the main steps for preparing a sql server database.
Regards,
Omid.|||Also, Carl Prothman's Connection String Site (http://www.carlprothman.net/Default.aspx?tabid=81) is pretty handy.
Thanks alot for your helps but I can't connect to my database yet. I tried OLE DB too but I received the same error. I think something is wrong in my sql server. Can you tell me please what are the main steps for preparing a sql server database.
Regards,
Omid.|||Change SQL authentication mode to MIXED if you are trying to log on with sa/pwd mode.|||Change SQL authentication mode to MIXED if you are trying to log on with sa/pwd.|||I don't want to log on with sa/pwd. I want to use windows authentication.

Sunday, March 25, 2012

Connecting to SQL dbfs with existing code

No need to setup the web server as a primary domain
controller for the SQL Server connectivity to work.
After you configured the system DSN on the web server, did
you test the DSN as the very last step of setting up the
DSN? If yes, what error message did you get?
Linchi
quote:

>--Original Message--
>We recently moved our Access databases to SQL and are
>trying to get our pages to open the connections to the
>server. I've set the system DSNs on the server as needed.
>However, no connections are made. After reviewing several
>books, microsoft.com, etc...I'm severely frustrated. The
>only thing I can think that would possibly be an issue is
>that our webserver (Win2003) is not setup as a Primary
>Domain Server and we have to connect via http.
>Any suggestions are appreciated. THANKS!
>.
>
The test was completed successfully. That's what is perplexing.
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!|||Does the connection actually hit SQL Server?
Enable auditing for failed logins on SQL , then stop n start MSSQLServer
service.
Check the SQL Errorlogs after the failed connection attempt.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.sqlsql

Connecting to SQL Database?

I am very new to web development using Microsoft Visual Studio. (my primary expertise is Framemaker 2003). I am currently going through your ASP.NET 2.0 videos and reproducing the lesson content on my development system. I have Microsoft Visual Studio 2005 Professional Edition. I also have Microsoft SQL Server 2005, Microsoft SQL Server 2000, Microsoft .NET Framework SDK v1.1 and Microsoft .NET Framework SDK v2.0.

I seem to be having difficulties with the SQL interface because when I try to use the Property object from Lesson04, I get System.Web.HttpExceptioon {"Unable to connect to SQL Server database."}. When I subsequently tried to Add New Item - SQL Database from Lesson08, I get a Microsoft Visual Studio error box "Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL:http://go.microsoft.com/fwlink/?LinkId=49251"

Any ideas? I know the videos are based on use of the Microsoft Visual Studio Express -- are there significant configuration differences between it and Microsoft Visual Studio Professional that would make these lessons incompatible?

If you have SQL Server Express edition installed on the machine where Visual Studio Express edition is installed, the problem most likely lies in your web.config file. The web.config file holds configuration for we application. Look for a connectionStrings element in that file and verify that it is correct.

|||

There are significant differences between SqlServer 2005 and Sql Server 2005 Express. You must have the Sql Server 2005 Express addition to use databases in your App_Data directory. It sounds like you don't have Express installed.

|||

I am running these lessons on Microsoft Visual StudioProfessional, notExpress. Why would I then have to have SQL ServerExpress installed?

I need to learn how to develop these web applications using the Professional package, especially the ability to interface a web app with a MySql database.

Is there something about these videos that are unique to the Express versions of these tools?

NOTE: My development environment at work is a closed system -- there is no internet connection (DoD classified, etc). I have no Express version of the web development tools installed. What I do have is the full-blowned Professional Team version.

|||

You need some form of a database system to use some of the features of ASP.NET, like Membership and Roles. You can choose most major databases but you will need a "Provider" for the function you are trying to use.

|||

jguadagno:

You need some form of a database system to use some of the features of ASP.NET, like Membership and Roles. You can choose most major databases but you will need a "Provider" for the function you are trying to use.

Please forgive the ignorance: When I say I am NEW that is about as literal as you can get. "Provider"? Is there something I can do with a configuration file or something so that when I select "Website/Add New Item.../SQL Database" I don't get"Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL:http://go.microsoft.com/fwlink/?LinkId=49251"?

|||

If you want to add a SQL Server Database to your project you need to have either SQL Server, SQL Server Express or access to a SQL Server. Microsoft provides the "Providers" which implement certain functionality for SQL Server. If you want to use another database like Oracle or MySql, you will need a custom provider.

If you are just using the database for data access, you can use pretty much any database.

For more on the Provider model, check this outhttp://msdn2.microsoft.com/en-us/library/aa479030.aspx . It is about 120 pages.

|||

jguadagno:

If you want to add a SQL Server Database to your projectyou need to have either SQL Server, SQL Server Express or access to a SQL Server. Microsoft provides the "Providers" which implement certain functionality for SQL Server. If you want to use another database like Oracle or MySql, you will need a custom provider.

If you are just using the database for data access, you can use pretty much any database.

For more on the Provider model, check this outhttp://msdn2.microsoft.com/en-us/library/aa479030.aspx . It is about 120 pages.

That is not represented in this list?

I have Microsoft Visual Studio 2005 Professional Edition. I also haveMicrosoft SQL Server 2005, Microsoft SQL Server 2000, Microsoft .NET Framework SDK v1.1 and Microsoft .NET Framework SDK v2.0.

|||

The you will need to create a database on the Microsoft SQL Server 2005 server first. Here is some more information on SQL Serverhttp://msdn2.microsoft.com/en-us/sql/default.aspx

|||

jguadagno:

The you will need to create a database on the Microsoft SQL Server 2005 server first. Here is some more information on SQL Serverhttp://msdn2.microsoft.com/en-us/sql/default.aspx

Actually, I have done that and even updated the "connectString" configuration to point to the "Test" database I created. This is really a tangent to the intent of the the ASP.NET Lesson07, which is supposed to show my how to establish and connect to a SQL Database from within a web application development session.

I greatly appreciate your attempts to help me understand the database connectivity problem I am having. Your comments, however, isn't really addressing my main problem. My problem is directly related to the use of the "Add New Item...SQL Database" from within Visual Studio 2005 Professional. Regardless of what I do with MS SQL Server 2005 I still get the error "...requires SQL Server Express 2005 to function properly".

NOTE: I finally managed to download and install the free Visual Web Development Express 2005 on my home desktop. In addition to installing the Express version of Visual Studio 2005, it also installed the Express version of MS SQL Server. Without ANY configuration changes on my part, I reproduced the ASP.NET Lesson07 on my home desktop and had no problems.

Is there anyone out there that has reproduced these tutorials using Visual Studio 2005 Professional rather than the free Visual Web Development Express 2005.

|||

I'm having the same problem, the same error message when hit 'App-Data'->'add new item' -> 'SQL database'

I have SQL Server 2000 and 2005, VS professional, so I wondered why I need to install Express editions to make the samples work? there must be some ways, just that I dont know.

Connecting to SQL Data Base with ADODB

Hi I need help regarding ADODB Connection that i have used in connecting database in my web application, do tell me is this connection type is ok? or I need to switch to ADO.NET Connection.

Hi There,

Of course you still can use ADODB, below is some example:

http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=54

http://www.vbdotnetheaven.com/UploadFile/ptailor/ADODBServices04082005081324AM/ADODBServices.aspx

Having said that, i long run, you should migrate to ADO.net. ;) Good luck!

Connecting to SQL 2005 via DBI Perl and Vista problems.

I am trying to connect to a 2005 SQL server though perl using the DBI module.
When the perl script is uploaded to my web server the connection is made with
no problems but if I download the file to my local machine and run the file I
get "[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
have added the DSN into Vista 6 times and the test run fine but I can not run
this perl script, or any other perl script that uses DBI to get to the SQL
server. Can anyone help me?
Never Mind, found it. Why do the answers only show up after asking for help.
Found this site
http://msmvps.com/blogs/spywaresucks/archive/2007/05/11/897398.aspx
and whent via run command to the syswow64 version of ODBC and added it in
there and worked. But I find it really odd that when I when to the ODBC via
Admin Tools in Control Panel it was not working. O, well.
"Eagle_f90" wrote:

> I am trying to connect to a 2005 SQL server though perl using the DBI module.
> When the perl script is uploaded to my web server the connection is made with
> no problems but if I download the file to my local machine and run the file I
> get "[Microsoft][ODBC Driver Manager] Data source name not found and no
> default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
> have added the DSN into Vista 6 times and the test run fine but I can not run
> this perl script, or any other perl script that uses DBI to get to the SQL
> server. Can anyone help me?

Connecting to SQL 2005 via DBI Perl and Vista problems.

I am trying to connect to a 2005 SQL server though PERL using the DBI module
.
When the PERL script is uploaded to my web server the connection is made wit
h
no problems but if I download the file to my local machine and run the file
I
get "[Microsoft][ODBC Driver Manager] Data source name not found and
no
default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
have added the DSN into Vista 6 times and the test run fine but I can not ru
n
this PERL script, or any other PERL script that uses DBI to get to the SQL
server. Can anyone help me?Never Mind, found it. Why do the answers only show up after asking for help.
Found this site
http://msmvps.com/blogs/spywaresuck.../11/897398.aspx
and whent via run command to the syswow64 version of ODBC and added it in
there and worked. But I find it really odd that when I when to the ODBC via
Admin Tools in Control Panel it was not working. O, well.
"Eagle_f90" wrote:

> I am trying to connect to a 2005 SQL server though PERL using the DBI modu
le.
> When the PERL script is uploaded to my web server the connection is made w
ith
> no problems but if I download the file to my local machine and run the fil
e I
> get "[Microsoft][ODBC Driver Manager] Data source name not found a
nd no
> default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
> have added the DSN into Vista 6 times and the test run fine but I can not
run
> this PERL script, or any other PERL script that uses DBI to get to the SQL
> server. Can anyone help me?

Thursday, March 22, 2012

connecting to SQL 2000 Server gives SQL 2005 error message

Hi,

Here is the syntax of the connection string within the web.config file:

<connectionStrings>
<clear />

<addname="MyConnectionString"connectionString="Data Source=000.000.000;Initial Catalog=Database Name;Persist Security Info=True;User ID=XXXXXX;Password=XXXXXX;"providerName="System.Data.SqlClient" />

</connectionStrings>

The test page has a GridView in it which uses the connectionstring fron the web.config file.

Error Message:

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 allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Not sure why .NET thinks it's a SQL 2005 server

I can connect to the database via VS 2005, and through Enterprise Manager... just from the ASP.NET page.

Any ideas?

Thanks,
Roland

By default SQ2005 does not have remote connections enable, you need to go to Surface Configuration and the first tap change from pipe to remote connections. That shall fix the problem.

|||

Thanks Al, but the problem is that the server is SQL 2000 and NOT SQL 2005.

So, I'm not sure why .NET thinks, or is getting the information to say that the SQL server is SQL 2005.

So to reiterate the question:

Why do I get a SQL 2005 error while connecting to a SQL 2000 database?

Thanks again,

Roland

|||

Then must be a firewall between or again you can change SQL 2000 to use only pipes, check that and let me know

|||

Why you got a message about MS SQL Server 2005 while the version you have is MS SQL Server 2000?

This is beacuse you are using MS Viusal Studio.NET 2005 which install a SQL Express (lite SQL Server - similar to MSDE) on your machine and by default it will coneect to it.

This SQL Express uses a SQL Server 2005 engine, and that is why you saw "When connecting to SQL Server 2005, ...." message.

Ok, what to do?

Change the default connection string from your IIS.

Open your IIS, then click on your "Virtual Directory" (e.g. your ASP.NET Website) then go to its configuration and change the Server name part in the ConnectionString.

Hope this will help you as it helped me eairler.

Regards,

sqlsql

Tuesday, March 20, 2012

Connecting to Northwind on SQL Server 2000

I've just installed SQL Server 2000 on my local machine. I'm using the following element in my web.config file for my connection string.

<add key="SqlNWind512" value="server=(local)\141.705.84.745;database=Northwind;
user id=sa;pwd=h3fe8eq7;packet size=512;" /
Unfortunately, I'm getting the following error on my aspx page:

SQL Server does not exist or access denied.

I had no problem writing a connection string to connect to the MSDE installed on my computer, but making a connection to the Northwind database on my newly installed SQL Server 2000 Developer edition has been elusive to me.

I'm sure my IP address is correct. The authentication mode for logging into the database via Enterprise Manager is setup to require a password for sa. Therefore, I assume it's required in the connection string?

Maybe not so coincidentally, while I have been able to open this database through the Server Explorer in VS.NET, I'm not able to access it via Enterprise Mananger (no response, it just hangs) or my aspx pages.

I'm dying here!!! Is my connection string wrong? Any insights would be greatly appreciated!just server=<ip address
forget the (local) bit if it's not local.|||Thank you!|||word to the wise..
Don't put your password to your database online on forums.

h3fe8eq7 can be a very bad thing.

Monday, March 19, 2012

Connecting to more Database

Hi ,

We have 10 web sites running and having 10 database stored in same server .
i need to check in all the 10 database that particular id has repated .
if it is repated i should not allow the user the create that id .

as it is we have 100k qry hitting the database per minute .. so have some performace issues .

if i write code to connect all the database is same file . will there be any performance issue .

or is there any other method to do that ...

Quote:

Originally Posted by rashmiks

Hi ,

We have 10 web sites running and having 10 database stored in same server .
i need to check in all the 10 database that particular id has repated .
if it is repated i should not allow the user the create that id .

as it is we have 100k qry hitting the database per minute .. so have some performace issues .

if i write code to connect all the database is same file . will there be any performance issue .

or is there any other method to do that ...


Hi there,

Kindly refer to below attached link. Please do not double post. Take care

Trigger

Thursday, March 8, 2012

Connecting to an external SQL 2000 Server from a Vista machine with SQL 2005 installed

hi there - I'm praying someone here can shed some light on this - after many google and web searches, I have found users with similar issues, but have yet to find a solution.

Problem:I have recently upgraded my desktop from Windows XP to Windows Vista Ultimate (clean install) and have migrated my local machine to SQL Server 2005. However I have a number of .Net projects that access databased on another server running SQL Server 2000 - prior to my upgrade to Vista, I was running SQL Server 2000 on my desktop as well. During the install, everything seemed to go well, and I also installed the SQL Server 2005 Service pack as instructed via the MSDN site. However, when attempting to test my .net projects on my desktop pc (ie visithttp://localhost), I encounter the error:

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 allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

note that the server I am attempting to connectTO is the old SQL 2000 server - NOT 2005. I specify my connection info in the web.config - and it points to an external ip address on the web.

Can anyone shed some light on this? I've tried enabling remote access on my local SQL 2005 install, but I'm fairly sure thats for servers that want to connect to my desktop, rather than my desktop attempting to connect to external servers. Any help is greatly appreciated - I'm pulling my hair out over trying to figure this out! :)

To summarize my setup (if it helps)

Desktop PC:
Windows Vista (Ultimate)
SQL Server 2005
Visual Studio 2005
II 7.0
.Net 2.0 (ASP.Net Application)

External Server (co-located at a datacenter)
Windows Server 2003
SQL Server 2000
IIS 6.0
.Net 2.0 (ASP.Net Application)

Much appreciated,

Ted

http://forums.asp.net/thread/1476735.aspx|||

Hi Al - thanks for the reply!

I followed the instructions, but am still running into the error. To re-state, the server my code is trying to connect to is only running SQL Server 2000, not SQL Server 2005. Can you enlighten me as to why I'd be getting an error stating that it is trying to connect to a 2005 database?

Much appreciated!

|||Very confused, I believe there is a bug in the provider, I seen a post before with a msdn2 link. I'll try to find it and post it in this thread|||

Did anyone here got hold of this issue. Could someone shed some light ?

|||

I've just run into exactly the same issue as that described in the beginning of this thread. Is there a solution out there for this problem? I'm running Vista Ultimate and Visual Studio 2005, but only SQL Server Management Studio Express.

Connecting to a web based MSSQL DB

Hi all,

I'm running a MSSQL DB on our web server and currently I need to use Teratrax Database Manager to connect and manage it. Unfortunately this doesn't seem to have any features to export the data from the database.

I read somewhere about an online MSSQL tool which can manage online databases? Does this exist?

What tool would I use to connect to my database to export data from it? I have an evaluation copy of MS SQL Server 2005 but my knowledge with it is limited and I'm having trouble getting it connected to a remote DB (local DBs are fine).

Any help would be appreciated!

Thanks!

Hi,

although there are some applications out there to administer SQL Server, they are just mimic to SQL Server Enterprise Manager / Managment Studio (you didn′t tell which version of SQL Server you want to administer). Perhpas you should get a CAL to administer the boxes on the web. SQL EM and SQLMS works fine over the internet and should save you some time compared to using a small featured similiar application.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Wednesday, March 7, 2012

connecting to a remote sql server problem..

i have sql server 2000 running on a windows server 2003 machine but have my web application on another windows xp machine

i'm getting access denied from the client machine... the 2 computers are connected by workgroup..

anyone can tell me how and what i need to do to connect to the sql server thanks

Hi There

Are you using impersonation in the web.config?

If not youll be trying to access sql server as the asp.net account on the web server - this wont have access to the db on the other server - either grant access on the sql server to the aspnet account or create a new account on the web server, then use this account using imperonsation in the web.config to access the sql server machine and the database.

Thanks
Gregor

|||

That might be caused by incorrect config of sql server ,issues of permission , connection string error,fire wall blocking...

You'd better elaberate your error message.

Connecting to a remote sql server

Hi,
I have a web application installed on a server. I want to connect to aremote database server. I have access to both the servers, I can assignany user privileges or settings that are needed. How do I do this? Itried it the usual way, specifying the conn string and opening theconn, and expectedly it throwed an sql server does not exists error.
Thanks.
When you say you specifiy the connection string, I'm assuming it's a correct string, but you didn't give us any info about the string - - Are you trying an explicit logon (uid/pwd) or Windows Authentication?
|||I am trying an explicit logon with username and password. The string isthe same one you normally use if you are connecting to a localdatdbase. I just tried changing the server name to the remote servername. Everything else is same.
|||That should work. The format for a local string will work for a remote string - if using SQL Authentication (explicit username and passwords).
The only difference is instead of a local IP (e.g., 127.0.0.1) or server name, use an IP accessiable from your webserver (e.g., 123.123.123.123, or mydatabase.mywebsite.com), whether private or public.
Of course, if you're getting "remote server cannot be found" kind of message, it could be firewall issue. Connecting this way to any SQL Server (local or remote) requires the correct port to open and reachable (default for SQL Server is 1433).
Some things to also keep in mind are the fact that your connection string is being sent over your private or public network (i.e., the internet) unencrypted, and that making open internet connections to SQL Server may require special licensing (as some have suggested).
Hope that helps.
|||Thanks Scott.

connecting to 2 diffrent sql servers databases from single web application

i am having 2 sql servers one is web sql server server and other server is my local sql server. i am making web application through which i want to connect both sql servers at a time and by selecting data from web server i want to insert it into my local sql server both having same database on which i want to work , i want to know how it can be done

my idea as follows in web.config i specify 2 connection string and by selecting data from websql server database table i going to store it in dataset and then i return dataset to another function which connects to local sqlserver database.but database records are much large. can any body guide me .

i am going to place my web application on local server (C# asp.net 2.0) .

thank you,

i tried this code

c# file

public partialclass _Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) { }protected void Button1_Click(object sender, EventArgs e) { Uupdatedata(); }public void Uupdatedata() {string constr1=ConfigurationSettings.AppSettings["abccon1"];string constr2 = ConfigurationSettings.AppSettings["abccon2"]; System.Data.SqlClient.SqlConnection dbcon1 =new System.Data.SqlClient.SqlConnection(constr1); dbcon1.Open(); System.Data.SqlClient.SqlConnection dbcon2 =new System.Data.SqlClient.SqlConnection(constr2); dbcon2.Open(); SqlDataReader dr; SqlCommand cmd =new SqlCommand("select * from Unit_Master",dbcon1); dr = cmd.ExecuteReader();while (dr.Read()) {string Sql ="insert into Table1(Unit_Id,Unit_Desc) values(" + dr.GetInt32(0).ToString() +"," + dr.GetString(1) +")"; SqlCommand cmd1=new SqlCommand (Sql,dbcon2);//cmd1.EndExecuteNonQuery (); }//dr.Close(); //dbcon2.Close(); }

web.config

<configuration><appSettings><add key="abccon1" value="Data Source=comp01;Initial Catalog=abc;User Id=sa ; Password=sa"/><add key="abccon2" value="Data Source=comp01;Initial Catalog=abctest;User Id=sa ; Password=sa"/></appSettings><connectionStrings/>

this 2 databases are from single my loacl server

it wont work it gives exception

please healp me.

What line is the exception thrown on?

|||

And also, I'm going to assume that your obfuscating your connection information, because your just using "comp01" for both, and you said that 1 of the DB's is on a remote machine, correct?

|||

i pasted code of testing application i making and exception is not thrown but when i debug at that time in second connection ie dbcon2 properties shows exception otherwisecode works fine but nothing inserted in the second table,please healp me.

|||

Hi,

i specify 2 connection string and by selecting data from websql server database table i going to store it in dataset and then i return dataset to another function which connects to local sqlserver database

From your code you provided, it seems that you did not follow the way you mentioned, instead, you are using datareader to retrieve those data and create each insert command and execute it for each row, right? After you have create the sqlcommand, why don't use call the ExecuteNonQuery() method to execute the command.

Besides, you mentioned that the records in database are much large. Then you'll loop many times while retrieving your data from datareader, right? Then in your code, the sqlcommand object instance would be created repeatly. It would damage the performance. So what I suggest is create the instance of sqlcommand once, and modify the commandtext of sqlcommand and execute it in each loop.

Thanks.

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.