Forum Moderators: open

Message Too Old, No Replies

ASP with remote MySQL

         

pauld

7:05 pm on May 15, 2003 (gmt 0)

10+ Year Member



I'm new to ASP, so I got this ASP web application that needs to be connected to MySQL db. They both are sitting on different servers running IIS. The application works fine when its on the same machine as the db.

I'll post the web.config file, I think this is where I've to make chanes.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="DSN" value="some name" />
</appSettings>

<system.web>

<!-- DYNAMIC DEBUG COMPILATION
Set compilation debug="true" to enable ASPX debugging. Otherwise, setting this value to
false will improve runtime performance of this application.
Set compilation debug="true" to insert debugging symbols (.pdb information)
into the compiled page. Because this creates a larger file that executes
more slowly, you should set this value to true only when debugging and to
false at all other times. For more information, refer to the documentation about
debugging ASP .NET files.
-->
<compilation
defaultLanguage="c#"
debug="true"
/>

<!-- CUSTOM ERROR MESSAGES
Set customError mode values to control the display of user-friendly
error messages to users instead of error details (including a stack trace):

"On" Always display custom (friendly) messages
"Off" Always display detailed ASP.NET error information.
"RemoteOnly" Display custom (friendly) messages only to users not running
on the local Web server. This setting is recommended for security purposes, so
that you do not display application detail information to remote clients.
-->
<customErrors
mode="RemoteOnly"
/>

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

<!-- APPLICATION-LEVEL TRACE LOGGING
Application-level tracing enables trace log output for every page within an application.
Set trace enabled="true" to enable application trace logging. If pageOutput="true", the
trace information will be displayed at the bottom of each page. Otherwise, you can view the
application trace log by browsing the "trace.axd" page from your web application
root.
-->
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>

<!-- SESSION STATE SETTINGS
By default ASP .NET uses cookies to identify which requests belong to a particular session.
If cookies are not available, a session can be tracked by adding a session identifier to the URL.
To disable cookies, set sessionState cookieless="true".
-->
<sessionState
mode="InProc"
stateConnectionString="tcpip=some IP"
sqlConnectionString="data source=127.0.0.1;user id=testuser;password="
cookieless="false"
timeout="20"
/>

<!-- GLOBALIZATION
This section sets the globalization settings of the application.
-->
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>

</system.web>

</configuration>

txbakers

2:59 am on May 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A DatasourceName (DSN) will not work for you if the ASP pages are kept on one server and the mySql is kept on another.

You will have to use a DSN-less connection, and specify the full path to the server (IP address) in your connection. If the two servers are on the same domain, you might be able to use the machine Network name.

Why can't you run the ASP pages on the same server as the mySQL database?

pauld

5:04 am on May 16, 2003 (gmt 0)

10+ Year Member



It did work for me
I didn't touch anything in the web.config file
I had MyODBC installed on the local server and added a new System DNS with the same value as in the web.config file and specified the server name, login name, db name in the DNS and it worked.
You've to make sure the port you're trying to access in the remote server (where dB server is running) is open. And you've make sure that the db can accept the user that is specified in the System DNS.