473,671 Members | 2,251 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

localhost Accessing Remote SQL Database

Hi -

I have an ASP.NET web page accessing a SQL database. It works fine on the
web, and I'm trying to get it to also work in debug mode in the IDE. The
"on the web" page and my SQL database are hosted by a third party (on
separate servers).

Since debug mode opens IE and loads my page from localhost, since the
database is located at a web URL, and since my development machine has an
always-on DSL connection, I'm hoping there's a way to get this to work.

While I've provided (below) my entire page load event code, the connection
string that works when I upload the page to the third-party host is:

Network Library=dbmssoc n;Password=myPa ssword;User ID=myUser;Initi al
Catalog=myDB;Da ta Source=000.000. 000.000;

[values are changed for reasons of security.]

When I try to run the page on my development machine in debug mode, IE
opens, the status bar reports that it is opening my localhost page, and IE
hangs. (Eventually I get a page cannot be displayed error.) Again, this
same page works fine when uploaded.

I've also tried adding a ",1433" at the end of the Data Source URL as
suggested by connectionstrin gs.com. Same result.

How can I get this to work??

Thanks for your help.

- Jeff

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssoc n;"
strConn = strConn & "Password=myPas sword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000. 000.000;"

conMain = New SqlConnection(s trConn)
sqlCmd = New SqlCommand("SEL ECT FirstName, LastName FROM Customers",
conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteR eader

dgCustomers.Dat aSource = rdrCustomers
dgCustomers.Dat aBind()

conMain.Close()

Catch ex As Exception
Response.Write( ex.ToString)

End Try

End Sub
Nov 19 '05 #1
2 2291
Hi Jeff,

I develope locally and use an ASP.Net host to host all my sites and
databases. I've never had any trouble hitting the remote database from
inside VS.Net. For my connection string I've always used:

"SERVER=000.000 .000.000; database=dbName ; uid=UserName; pwd=Password;"

If using that doesn't help could you step through your code and let us know
which line it is hanging on. You may also want to use the Server Explorer
to connect to the DB just make sure it is working and hittable. Good luck!
Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Jeff" <je*********@eN etPortals.com> wrote in message
news:E6******** ********@newsre ad3.news.atl.ea rthlink.net...
Hi -

I have an ASP.NET web page accessing a SQL database. It works fine on the
web, and I'm trying to get it to also work in debug mode in the IDE. The
"on the web" page and my SQL database are hosted by a third party (on
separate servers).

Since debug mode opens IE and loads my page from localhost, since the
database is located at a web URL, and since my development machine has an
always-on DSL connection, I'm hoping there's a way to get this to work.

While I've provided (below) my entire page load event code, the connection
string that works when I upload the page to the third-party host is:

Network Library=dbmssoc n;Password=myPa ssword;User ID=myUser;Initi al
Catalog=myDB;Da ta Source=000.000. 000.000;

[values are changed for reasons of security.]

When I try to run the page on my development machine in debug mode, IE
opens, the status bar reports that it is opening my localhost page, and IE
hangs. (Eventually I get a page cannot be displayed error.) Again, this
same page works fine when uploaded.

I've also tried adding a ",1433" at the end of the Data Source URL as
suggested by connectionstrin gs.com. Same result.

How can I get this to work??

Thanks for your help.

- Jeff

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssoc n;"
strConn = strConn & "Password=myPas sword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000. 000.000;"

conMain = New SqlConnection(s trConn)
sqlCmd = New SqlCommand("SEL ECT FirstName, LastName FROM Customers",
conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteR eader

dgCustomers.Dat aSource = rdrCustomers
dgCustomers.Dat aBind()

conMain.Close()

Catch ex As Exception
Response.Write( ex.ToString)

End Try

End Sub

Nov 19 '05 #2
Thanks Ken -

After trying various combinations, including your suggested connection
string format, I no longer believe that the problem is with the connection
string (yours had the same result as the one I had tried).

As far as I can tell now, I think the issue may be a Page directive issue:
src vs codebehind. I've posted it in a new thread, since the 'Subject' no
longer applies; it's now posted as 'Running both in the IDE and on a remote
host.' I'd appreciate any further suggestions you can offer.

- Jeff
"Ken Dopierala Jr." <kd*********@wi .rr.com> wrote in message
news:Of******** ******@TK2MSFTN GP10.phx.gbl...
Hi Jeff,

I develope locally and use an ASP.Net host to host all my sites and
databases. I've never had any trouble hitting the remote database from
inside VS.Net. For my connection string I've always used:

"SERVER=000.000 .000.000; database=dbName ; uid=UserName; pwd=Password;"

If using that doesn't help could you step through your code and let us know which line it is hanging on. You may also want to use the Server Explorer
to connect to the DB just make sure it is working and hittable. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Jeff" <je*********@eN etPortals.com> wrote in message
news:E6******** ********@newsre ad3.news.atl.ea rthlink.net...
Hi -

I have an ASP.NET web page accessing a SQL database. It works fine on the web, and I'm trying to get it to also work in debug mode in the IDE. The "on the web" page and my SQL database are hosted by a third party (on
separate servers).

Since debug mode opens IE and loads my page from localhost, since the
database is located at a web URL, and since my development machine has an always-on DSL connection, I'm hoping there's a way to get this to work.

While I've provided (below) my entire page load event code, the connection string that works when I upload the page to the third-party host is:

Network Library=dbmssoc n;Password=myPa ssword;User ID=myUser;Initi al
Catalog=myDB;Da ta Source=000.000. 000.000;

[values are changed for reasons of security.]

When I try to run the page on my development machine in debug mode, IE
opens, the status bar reports that it is opening my localhost page, and IE hangs. (Eventually I get a page cannot be displayed error.) Again, this same page works fine when uploaded.

I've also tried adding a ",1433" at the end of the Data Source URL as
suggested by connectionstrin gs.com. Same result.

How can I get this to work??

Thanks for your help.

- Jeff

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
Dim conMain As SqlConnection
Dim sqlCmd As SqlCommand
Dim strConn As String

Try

strConn = ""
strConn = strConn & "Network Library=dbmssoc n;"
strConn = strConn & "Password=myPas sword;"
strConn = strConn & "User ID=myUser;"
strConn = strConn & "Initial Catalog=myDB;"
strConn = strConn & "Data Source=000.000. 000.000;"

conMain = New SqlConnection(s trConn)
sqlCmd = New SqlCommand("SEL ECT FirstName, LastName FROM Customers", conMain)
conMain.Open()

Dim rdrCustomers As SqlDataReader = sqlCmd.ExecuteR eader

dgCustomers.Dat aSource = rdrCustomers
dgCustomers.Dat aBind()

conMain.Close()

Catch ex As Exception
Response.Write( ex.ToString)

End Try

End Sub


Nov 19 '05 #3

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

Similar topics

4
2984
by: Jaydeep | last post by:
Hello, I am facing a strange problem. Problem accessing remote database from ASP using COM+ server application having VB components (ActiveX DLL) installed. Tier 1 : ASP front End (IIS 5.0) Tire 2 : COM objects Tier 3 : SQL Server 2000 DB Flow is : ASP talks with COM objects and COM objects talks with DB Scenario 1
2
7075
by: Douglas Harber | last post by:
If I have DB2 8.1 (FP5, I believe, but not relevant to my question...I hope) installed on my desktop, do I have what I need to connect to a remote DB2 server (also running 8.1 FP5) from my desktop machine? I assume, perhaps naively, that all the parts are there but I've spent several hours trying to grasp how to go about accessing the remote server. Specifically, I'm trying to create and populate databases on the remote server from...
3
4315
by: prodirect | last post by:
Hi all, I hope someone can help me. I've recently created a database and wanted to put it up on an ftp sight so that multiple people could access the same tables at the same time from different geographical locations. I have been completely unsucessful in acheiving this goal so far however. Things I have tried: Create a shortcut to ftp sight via browser then tried to map local drive to
2
1428
by: DavidR | last post by:
Hi, My development machine is running Win XP SP2 and IIS. I'm developing an ASP.NET application on this machine that accesses data from a SQL Server database on another machine. That machine that contains the SQL Server runs Win 2003 and is the primary controller for our domain. When I connect I receive the error "Login failed for user '(null)'. Reason:
6
3619
by: Brad | last post by:
I have a win2003 server workstation with multiple webs, each web has it's own ip address. In VS2005, if I select to open an existing web site, select Local IIS, the dialog correctly displays a list of all of my webs, however if I attempt to open a site under and web other than localhost I receive the message: "Unable to open the Web 'http://localhost/anywebappname'. The Web 'http://localhost/anywebappname' does not exist" Obviously...
0
1826
by: John Fleming | last post by:
Hello, I am building a web application with the following components: 2 Web Servers - Windows Server 2003 - IIS 6 - .Net Framework version 2.0 - Reside in Domain A 2 Clustered Database Servers
3
2685
by: Pakna | last post by:
Hello, I have what may be a beginner's question regarding DB2. How does one access a remote table on a remote database via SQL? What is the command string, is there an equivalent of Oracle DBLINK? I hope I was clear. If there are more information that I need to supply, please do tell me. Thank you very much for your replies
5
3900
by: Mike | last post by:
I'm having trouble accessing SQL2005 Standard Edition as a second instance of SQL Server where the first instance is SQL 2000 Enterprise Edition. I installed SQL 2005 as a named instance "SQL2005". The server is running Windows 2000 SP4 ON A 32-Bit machine. When I look in Services I see the SQL Server (SQL2005), SQL Server Agent (SQL2005) services there. I went into SQL Server Configuration manager and disabled the named pipes protocol...
4
4219
by: Noy B | last post by:
Hi, I have developed a small application that is using a MSAccess DB. the problem is that it was developed on a machine where the application and the DB are both located. now it needs to be change that the application will be able to run on any other machine (using \\ syntax on the run command- not a problem) using the DB located on a static-different machine. for this purpose I need to create a Remote Connection from my
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8821
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8598
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6229
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
2051
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1809
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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

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