Вы находитесь на странице: 1из 3

Connect to Access database remotely

Ask Question

1
I am trying to connect to my access databse that I have hosted with godaddy. I have ASP 3.5, Php
5.2, and IIS 7. I have gone and set up a virtual directory in my IIS settings for the vb script. I am
using Microsoft Visual Web Developer 2008. Could anyone please let me know if they see
something wrong with my connection string to the remote database? I really need to use Access for
this. Thanks

The code is similar to a tutorial I followed. Tutorial (it is in Spanish but code works locally not
remotely)
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim objConn As Object
Dim objRecords As Object
Dim strConn As String
Dim strQuery As String

objConn = Server.CreateObject("ADODB.Connection")
strConn = "Provider=MS Remote;" & "Remote Server=http://(IP Address here);" & "Remote
Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("/logs/App_Data/users.mdb") &
"Uid=admin" & "Pwd="
objConn.Open(strConn)

strQuery = "SELECT * FROM tbl_usuarios"


strQuery = strQuery + " Where str_usuario_ide='" + Login1.UserName + "'"
strQuery = strQuery + " And str_usuario_cve='" + Login1.Password + "'"

objRecords = objConn.Execute(strQuery)
If (Not objRecords.BOF) Then
e.Authenticated = True
Else
e.Authenticated = False
End If

objRecords.Close()
objConn.Close()
objRecords = Nothing
objConn = Nothing
End Sub
End Class

asp.net vb.net ms-access

shareimprove this question


asked Jul 9 '12 at 1:54
Grant Wilkinson
573935
 a mix of PHP and ASP ? Are you sure the Access is available on GoDaddy server already ? Also, why
don't you host your script on GoDaddy as well ? – Raptor Jul 9 '12 at 2:15
 Well the server just has asp and php installed. I thought that would be helpful as a referece. The script is
hosted on Godaddy's servers it just gives me a Server Error in '/logs' Application. message
when I try to connect to it. – Grant Wilkinson Jul 9 '12 at 2:20
 I assumed you are subscribing to shared hosting plan instead of 4GH series plans, right? as the 4GH
plans have no MS Access service... – Raptor Jul 9 '12 at 2:27
 Yes it is a shared hosting plan. I could use the MS Access service and create a dsn for the database but I
would need some help into converting the connection string I have above to a dsn. Is that what you were
thinking? Thanks – Grant Wilkinson Jul 9 '12 at 2:35
add a comment
1 Answer
activeoldest votes

6
You cannot connect to an MS Access database residing on a server unless you use a full UNC path
name. That means a NON http:// technology

http: is a GALACTIC different kind of technology then the windows networking system. To
correctly open an Excel file, word file or in this case an Access file you cannot use ftp, or something
like http:

You need to use windows networking. That means you need to setup a VPN and ALSO you need to
be running WINDOWS networking (not Linux, and not apple OS on that server). In the case of
Linux, you could hope and "require" that SAMBA is installed to get you the standard windows
networking system. (so for a windows computer to open files on a Linux computer, you need a
"windows compatible" networking system installed.

So a connection string to connect to a standard mdb or accDB file is a FULL QUALIFIED windows
path name. The path name you supply MUST be a standard windows path name, and MUST be
based on a standard windows networking system. So if you setup a VPN and THEN you can browse
the files in that folder via windows networking (not http and not FTP), then the standard windows
locking and opening mechanizes will work and are required for opening of a standard windows file
sitting on a folder. So you IN ALL CASES Still require a folder on your local hard drive or one that
mapped from Network Neighborhood. And as noted, the networking system in place here has to be
windows networking. I do not believe that GoDaddy has for basic plans the ability for a VPN and
direct file use and manipulation of basic files sitting on their servers (you have to use ftp to place
files on their servers – not a shared windows networking folder). And MORE important such direct
file use in the case of mdb/accDB files MUST be windows networking.

I have read that GoDaddy does allow external connections to their database server options. So MySql
or possible SQL server for windows package. However the caveat here is that by default for MOST
plans they do not allow the wild internet to external connect to their internal data base servers. In fact
in any plan where they do allow such connections then they "move" the hosted web site to another set
of servers so that if at least if compromised by allowing the wild world of the internet to "connect' to
these internal database servers then not all servers will be effected or compromised by such a security
breach.
I would thus suggest you use a true database server. I see little (if any) reason to attempt to use a mdb
file sitting on a web server anyway.

So SQL server or MySql can accept a socket connection and can do so over ANY network that
supports TC/IP. However a MS Access "file" does not accept such connections. So no http, or ftp
allowed. Remember an "mdb" or "accDB" file is simply a file sitting on the hard drive.

As such when you use Excel, Power-point, AUTO CAD, or a simple Access file, then no such
"socket" connection is possible. So you can no more use a connection string to Power-Point then you
can to a simple windows file sitting on the web server hard drive that just happens to have an mdb or
accDB extension.

A file is a file is a file. A horse is a horse is a horse. So you are talking about a plain Jane windows
file sitting on a folder on that server.

If you going to use a windows program (such as power point or in this case MS Access) to open and
modify that file, then you need to open that file using standard windows networking, and not some
type of web based connection system.

So no connection string is possible to open a plane jane windows file, be it your favorite paint
program or simply an Access file.

Of course if the software you are buidling is running server side and the "JET" engine is correctly
installed on that server (and it must be), then you can write some vb.net or any kind of code that has a
standard oleDB connection string. So for server side code, you most certaninly can use a conneciton
string, but if you look CLOSE you will ALWAYS be using a full qualifed windows path name and as
noted you have to be running a windows compatable server with the JET database engine installed.

shareimprove this answer

Вам также может понравиться