Page 1 of 1

Database on Windows x64

Posted: Wed Dec 23, 2009 12:01 pm
by Darwusch
For my home server I use Windows 7 x64.
On this server several services are running, e.g. a webserver with IIS 7.5, Homeseer and the Plugwise service.
Now I would like to make a website that uses data from the database that UltraLog (HS plugin) makes from several events.
But here I discovered that the ODBC driver on my system is 32 bit and can not be used with the 64 bit webserver.
A 64 bit ODBC driver is beeing developed (in MS Office 2010) but it's not available as a seperate driver yet, without installing Office 2010.
I have made a seperate application pool in IIS which has "enable 32 bit applications" enabled. But this doesn't seem to help. I can not make contact to an MS Access database through either php or asp.

How do people with a 64 bit windows server solve this? Do you run IIS as a 32 bit application for example?

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 12:10 pm
by Rene
Maybe this will help you making progress

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 12:44 pm
by Darwusch
Thank you for the tip Rene. However, this site was the reason why I tried the seperate application pool which I described.
But still I can't contact the Access database.

The error with a php script is with both the default application pool and the 32 bit application pool :
Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application, SQL state IM014 in SQLConnect in C:\inetpub\wwwroot\home\log.php

With asp I get a HTTP 500 Internal Server Error, with both application pools.

I can't find what I'm doing wrong here. It's weird I don't see a different result.

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 2:59 pm
by Darwusch
Finally I solved it. There were no read permissions in the registry to the ODBC driver locations.
I found the solution here:
http://support.microsoft.com/kb/306345" onclick="window.open(this.href);return false;

Now I can access the Access database with asp.

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 4:12 pm
by Darwusch
Ok now I have another challenge.
I can get access to a database, but not to a database that is in use by the program that writes to it.
Then this message occurs:

Code: Select all

Microsoft JET Database Engine error '80004005' 
Could not use ''; file already in use.
I'm sure it must be possible to only read from a database.
I searched the internet but I can't find a working solution.

The following code is used to open the database:

Code: Select all

Dim adoCon
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & DBPath = server.mappath("database.mdb")
And the error is on the last line given here.
Could somebody help me out here?

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 4:29 pm
by Digit
This looks incorrect:
& DBPath = server.mappath("database.mdb")
propably should be
& DBPath & server.mappath("database.mdb") ?
and put the result on the screen to check if the value is ok.

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 4:38 pm
by LostDreamer
I've had similar problems when trying to set up a ODBC connection from PHP to the Plugwise database.
There is a read-only setting when you go to your system-DSN connections where you set up the ODBC connection to the access db
click on Options and select the read-only.

It might be that this does the trick (it did not for me, since plugwise had the file set as exclusive)

Finaly I had to go for a work-around:
Since the plugwise DB was only updated every hour, I could have the file copied to a different location and set up my ODBC connection to the copy.
Then have a task copy the DB every hour.
PHP / ASP / VBscript was unable to copy the file because of the File in use error, But Windows Explorer (and batch files) could.

Hope it can help you.

LostDreamer

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 4:54 pm
by Darwusch
Because I had to point to the physical path, I changed my code to:

Code: Select all

adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & "C:/Program Files (x86)/HomeSeer HSPRO/Data/UltraLog/database.mdb"
And that gives the same error.

Re: Database on Windows x64

Posted: Wed Dec 23, 2009 7:13 pm
by Darwusch
LostDreamer wrote:Finaly I had to go for a work-around:
Since the plugwise DB was only updated every hour, I could have the file copied to a different location and set up my ODBC connection to the copy.
Then have a task copy the DB every hour.
PHP / ASP / VBscript was unable to copy the file because of the File in use error, But Windows Explorer (and batch files) could.

LostDreamer
The copying works, with a seperate script in homeseer.
Thank you!

Re: Database on Windows x64

Posted: Thu Dec 24, 2009 2:22 pm
by Darwusch
Because MySQL doesn't have the problem with database files which are in use (and inaccessible), I switched to MySQL.
This works a lot better. Also it has 64 bit drivers.

Re: Database on Windows x64

Posted: Thu Dec 24, 2009 2:37 pm
by LostDreamer
That, ofcourse, is allways better then Access :)
Nice to hear you solved it.