Replies Back to Article
Switching from ODBC to OLE DB
Hello, I have used DSNless connections before, but always within handcoded sections. When using UD however, I have always been forced either to make a local DSNless connection (i.e. needing modifications when uploading to the remote server) or to use ODBC.
All my attempts at using the Server.Mappath method within the UD connections window have been so far fruitless and frustrating. Can this be done at all? I am not quite sure about the use of quotation marks(") in this window, and I am pretty sure that this is the cause of my problems, but I think I have tried all combinations.
This is more or less the actual string I have been using, causing the above error
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("\mdb-database\Tabellini.mdb")
This connection works:
Provider=Microsoft.Jet.OLEDB.4.0;Data source="C":\Inetpub\wwwroot\StudioTabellini\mdb-database\Tabellini.mdb
I suppose the solution is very simple but I don't seem to be able to find it :-)
Hello Piero,
Did you try using the extension i link in the tuturial to get the Mappath ? Now what i described works fine, and i have helped a lot of people with this so far. If you could give me some detailed step-by-step information on what your try to do i would be able to give you some specific information on where the problem is. And yes, as you quote the solution is very simple, but one typo in the string and it won't work, so let's get you connected soon!
Dave Joosten
Thanks a lot, Dave, for your helpfulness, as well as for your good tutorials.
My problem is not really that I don't know the physical path to the database on the server, but rather that I don't know how to use the Mappath method within the UD interface. I have been using a mappath file that I keep at hand when I am using a new remote server. In fact, I have modelled my subfolder structure on some of my sites to be able to make changes easily and to test them locally. However I did this either by using the mappath method within a handcoded connection, which prevented me from using UD to full extent (eg. recordsets with a red ! exclamation mark, etc.), or using the physical path, which caused some errors when by mistake I would load the local connection file to the server (there will always be difference, eg the server unit being E:/ while the local is C:/) .
My question really remains:
does the connections window accept a string using the Mappath method in the string itself and what is the correct syntax?
Thanks once more for your kind help
Please disregard my previous message. The answer is:
Yes, it can be done, the proper syntax is though:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("..\somefoldername\somedatabasename.mdb")
(I was putting an extra quotation mark). As to the use of the backslashes and the dots, this depends of course on the folder location. However your tutorial should mention the quotation marks at the beginning of the string !
What about if you only use SQL Server. How would I adjust the global.asa file in this case?
Thanks
Hi guys, have been reading your comments with interest. I use Dreamweaver MX and am having exactly the same problem as Piero describes. I cannot get the connections window in Dreamweaver MX to accept a string using the Mappath method in the string itself. I keep on getting the error "Format of the initialization script does not conform to the OLE DB specification".
I have seen Piero's answer but I cannot get this to work - in fact, it looks exactly the same format as the recommendation on the Dreamweaver site and in the Dreamweaver help file. Surely other people must get this problem when using a DSN-less connection in the Dreamweaver UI.
Can you help at all?