Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I access database via virtual folder which points at a remote share
    text
    copied!<p>I'm having a problem getting access to a database which lives on a remote server. </p> <p>I have a ASP.NET 2.0 webpage that is trying to connect to a database.<br> The database is accessed via a virtual folder (which I set up in IIS).<br> The virtual folder points at a remote share which contains the database. </p> <p>The virtual folder (in the web apps root directory) is pointing at a share on a remote server via a UNC path: </p> <pre><code>\\databaseServerName\databaseFolder$\ </code></pre> <p>The virtual folder has 'read' and 'browse' permissions set to 'true'. </p> <p>I store the connection string in the 'appSettings' section of the web.config: </p> <pre><code>&lt;add key="conStrVirtual" value="Provider=Microsoft.Jet.OleDb.4.0;Data Source=http://webAppServerName/virtualFolderName/databaseName.MDB;Jet OLEDB:Database Password=dumbPassword;"/&gt; </code></pre> <p>The connection object is declard on my .aspx page: </p> <pre><code>Dim objConnVirtual As New OleDbConnection(ConfigurationManager.AppSettings("conStrVirtual")) </code></pre> <p>Here is the code that tries to use the connection object: </p> <pre><code>Public Sub Test() If objConnVirtual.State &lt;&gt; ConnectionState.Open Then objConnVirtual.Open() End If Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM TableName", objConnVirtual) objDR = cmd.ExecuteReader() If objDR.Read() Then response.write("Shazaam! Data shows up here") End If objDR.Close() objConnVirtual.Close() End Sub </code></pre> <p>When I run the above code I get the following error (on this line of the code 'objConnVirtual.Open()':<br> <strong>Exception Details: System.Data.OleDb.OleDbException: Not a valid file name.</strong></p> <p>I have checked the database name and it is correct (even copy/pasted it to make sure)</p> <p>If I put the 'Data Source' section of the connection string into the address bar of my browser I can successfully see the contents of the share on the remote server.</p> <p>Not sure if this is a problem with permissions or with the code.<br> I have googled the crap out of this but have not been able to find a solution.</p> <p>Any help is much appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload