Thursday, March 22, 2012

Server 2003 Web Edition Communicating with SQL Server on LAN

I am having problems getting my Web Server to communicate with the SQL server. My code works perfectly when running it from the SQL server (so it's seeing the database) but when I try to run it from the Web Server, it isn't seeing it. I am not a ASP programmer by any stretch and would appreciate any assistance in getting this to communicate. Thanks!

Ryan


is there an error?


There is not error. The drop down's that should be populated on the page, just don't show up. So the code populates these drop downs by utilizing data in the database. The fact they don't show up when running it from the web server seems like the database isn't being accessed. This page is a search page that queries people's information from the database. When I run the search it doesn't display anyone either. Firefox gives me this:

<%'CreateSelectList "LOCATION", "Location:","Choose a location", "LOCAT" 'CreateSelectList "EDUCATION", "Education:","Choose an education", "EDUCA" CreateSelectList "LANGUAGE", "Language:","Choose a language", "LANGE" 'CreateSelectList "ETHNIC", "Ethnic Origin:","Choose an ethnicity", "ETHNC"%>
 
IE just gives me this:
 "> 

Thats really not going to help sadly, You're going to have to dig into the code to test it out.

I know you can not install SQL on Web Edition, but as far as I know you can access it.
How was this configured before? What was changed/upgraded/etc... It's most likely just a config issue.


The wierd part about it is that it works perfectly on the SQL server itself. This exact code. All I did is move it to the Web Server, setup and ODBC connection, and then browse to the page again. That's it. So I don't know if you have any suggestions on the ODBC connection or if you can point me to a tutorial that would give me a step by step explanation on how to set this up. I do know that when I setup the ODBC connection, it says the test was "SUCCESSFUL" when connecting to the database. thanks for your prompt reply. I'm "under the gun" to get this going!

Ryan


I think we'll need to see some code for the web page itself and the code that accesses the database (if it is somewhere else).


go into the SQL configuration, make sure that "allow remote connections" is enabled.

Its not the webserver, its the db server thats blocking you


Below is what I use to connect to the database. I have the "Uncomment to display information about the server" portion uncommented and on the SQL server, when I browse to the search page, it displays exactly what I am connecting with. All the credentials are there. On the web server when I browse to the web page, it doesn't display the connection information and I just get the "junk" that I showed you in previous post.

<%' This file is to be included to set the path to the data for the connections' and other global variables.Dim strServer,strDB,strDBO,oSQL,strAuthMode,strUser,strPass,strImagePathstrServer="RIECSS01" ' This is the Server on which the data resides.strDB="Echo_live" ' This is the name of the database being accessed.strDBO ="dbo" 'This is the database owner to connect as.strAuthMode=""' Enter "SQL" to use SQL Server Authentication instead of Integrated (Windows) Auth.strUser=""' Not used unless strAuth="SQL"strPass=""' Not used unless strAuth="SQL"strImagePath="http://RIECSS01/ECHO/ECHO_image/depot_final/" 'Set this to your image path for provider photos in HTTP format. Ex: "http://server/images/"if strAuthMode="SQL" thenstrServer="^Server~"+strServer+"^LOGIN~"+strUser+"^PASSWORD~"+strPass+"^SQLA~Y"end if' --- Set Canadian Flag ---' Set the flag for whether the client is Canadian' If this is flagged as "YES" the following happens'(1) The word "ZIP CODE" becomes "Postal Code" '(2) The distance functions calculate in terms of Kilometers'(3) The word "Miles" becomes "Kilometers" wherever distance is displayedsession.Value("canada")="NO" 'Uncomment to display information about the serverResponse.Write "br>the server is:" &strServerResponse.Write "<br>the Database is:" &strDBResponse.Write "<br>the DBO is:" &strDBO' ----Create the oSQL SQL Select Object ----set oSQL = CreateObject("QEDATA.SQLSelect") 'This is the database connection object.' --- This function changes the spaces to %20function RidSpaces(vlu)RidSpaces = replace(vlu," ","%20")end function' ---- This function changes \ to /function FixBackSlash(vlu)FixTick = Replace(vlu,"\","/")end function' ------- This function removes the tick "'" mark' look into possibly using htmlEncode() for thisfunction FixTick(vlu)FixTick = Replace(vlu,"'","''")end function' ------- Rids the path and returns only the filenamefunction RidPath(vlu)RidPath = trim(right(vlu, len(vlu)- InstrRev(vlu,"\"))) end function 'Write to hitsdim strPage, strID, strHitSQLstrPage = mid(Request.ServerVariables("script_name"), instrrev(Request.ServerVariables("script_name"), "/") + 1)strID = Request.QueryString("id")strHitSQL = "insert into msl_hits(dte, time, page, dr_id) values('"&date()&"', convert(varchar(8), getdate(), 8), '" & strPage & "', '" & strID & "')"oSQL.Insert_Record strServer, strDB, strHitSQL' end code block%>

Curt,

I am running SQL Server 2000. When I go into enterprise manager and go to properties, I go to security. I have SQL Server and Windows selected as the authentication type. Under connections I have "Allow other SQL Servers to connect remotely to this SQL server using RPC" selected as well. Where else would I check? Thanks.

Ryan


I was under the impression it was SQL 2005...

does anything connect to this SQL server other then its own box? Just trying to see if thre is anytihg inbetween that may cause issues (firewall, router, etc).


No. That is the only database on there. When I do a trace route from the web server to the SQL server, there is nothing between them.


Hmm... do you have IIS on your PC?

Try loading the site on your machine once, see if it works from there. Just trying to see if its a config on the web server or something else...


IIS is on the web server, but the site isn't setup in IIS. I am just browsing to the .asp file through windows explorer. Does it actually need to be setup as a "website" in IIS first?

Also, I can connect to the website by browsing it to the SQL server directly from my local computer. So the site will run on my machine just fine if I access it on the SQL server from my machine. It won't run if I try to access the same code on the Web Server.


AGH....yes...

Asp.Net must be viewed in the context of a web server served site/application. They are parsed by the web server engine and rendered...


OK. So, I need to go into IIS and setup a website. Is there anything else I need to do? Is there a good tutorial you could point me to? (I have used apache my whole life so you will have to forgive me for these basic questions!) Thanks again for all your help.

0 comments:

Post a Comment