Here's something I've been attempting to accomplish for (sadly) months now. I've been shown that certain things are suppouse to work but I haven't had any luck. So, hopefully I'll get this resolved this time through.

Right now I'm trying to access a database over my local network. I have a odbc connection and it points to a database that is on a machine I have mapped through a letter drive.

My machine is a windows 2000 machine running apache web server.
The machine with the database is a windows 98 machine.

This is my connection string:
$connectionstring = odbc_connect("scdb", " ", " ","SQL_CUR_USE_ODBC");

which it first trips on. I would appreciate any help or pointers.

Thanks!

    make sure that your odbc connection is a SYSTEM DSN on the windows box where you run apache.

    Also, I was unable to get this to work with apache 2, I had to rever to apache 1.3 and everything worked fine......

      I didn't have much time to write my post so I left out an important detail.
      I've been receiving an error when running my code.

      [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot open the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view its data., SQL state S1000 in SQLConnect

        what version of apache?

        Windows?

        This is the exact problem I was having with Apache 2.

        Also, check the priveleges of apache.....The apache USER must have access to the data files on the server.....or map the network drive to the apache user...

        It is important to note that the odbc connection uses whatever user your apache guest acount is (Apache, Guest, Anonymous, Nobody...). It is THIS user that MUST have priveleges to read (or write) to the networked drive..so they need a network login.....

        Try This:

        Stop the apache service. Log into your webserver as adminstrtor, map the network drive, setup the ODBC connection as SYSTEM, then run apache from a command prompt, NOT AS A SERVICE. See if your odbc connections work. If they do, then once again it is a problem with the PRIVELEGES of the usder running the service.

          I'm using windows 2000.
          It worked and after a little snooping around I found where to set privledges for Apache. I'm a little confused though. The apache service was set at system level, which I would assume would be at the same level as Administrator. I guess it isn't. Or maybe there's something else going on.

          Anyway, thanks a bunch!

            Just remeber....That by changing the priv's for the apache server/service you open your security up quite a bit (Isn't Micro$oft Software Wonderfull?!)

              O.o Grrr... I think its about time to bring my linux box back to life. Does linux have the same problem? (of course that would probably defeat the purpose of getting odbc to work in my current situation).

              Shouldn't running apache with system privledges get the job done?
              Do you know anyway around the exploit issue?

                heheh....

                Unfortunately I have a similar problem...but luckily it on an internal intrAnet only...

                I have a Faircom C-TREE ODBC driver (which is only available for windows), and none of the "generic" drivers for linux would work. I was forced to run apache on a microsoft machine (YUCK!). Faircom is supposed to release JDBC drivers (which would be Linux Compat) sometime this year...but do I really want to re-work all that code?

                If onde of the Linux ODBC drivers will work for your database, then sure you can use a linux server...otherwisse you have to stick with Billy Bob and his heap of mess...(ome call it windows)

                  I don't use ODBC to connect to a database with PHP, its too much of a hassle and causes problems like you have. I just hard code the connection in.

                  Why don't you just export the Access DB to mysql? Its quite easy

                    The ODBC commands are very similar to MySQL. Additionally, ODBC allows you to connect to many different kinds of databases, not just Microsoft Access. There are 100's of tiny little highly specialized database products out there with ODBC drivers which you may some day need to access. In mysituation, I was pulling info from an MSDOS based system which is used to fill prescriptions in about 60% of pharmacies across america. You can't exactly just copy that over to MySQL.

                    The most common ODBC problem (from my experience) are priveleges. You can only access the network drives/files as the user running apache. This is normally a problem, because by default the apache user will not have access to the file system on a windows box.

                      I know what you mean...

                      But...

                      an option that I gave above regarding exporting out of access into mysql is just another option. I don't have any problems accessing a mysql server with ODBC.

                      Anyways, did he check permission on the access DB itself? That could be not accessible only by administrator. Need to give full control to all users.

                        Actually....

                        If he doesn't need to write any data back to the ODBC database, it not's too bad. Place the ODBC database on a drive/dir by itself, and give the apache user READ only access. Worst case, people would be able to read, but not change your data.

                        Of course, this assumes that they can't compromise your windows box.

                          Write a Reply...