Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Creating Connection File by hardcoding it?

New Here ,
Jan 10, 2009 Jan 10, 2009
When one connects to a database the name for the connection is the "Data Source Name" which is then recorded to a file that appears in the grayed Source Code area. For example, connecting to a database (under database tab) named Herbie creates a file called Herbie.asp (programming in VB Script). This file is then saved to a directory off the root called Connections.

How do we take an existing Connections file and tell dreamweaver to incorporate it into a given page without going through the Database tab process?

Any input would be appreciated. Thanks!

TOPICS
Server side applications
523
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2009 Jan 10, 2009
WAStrnad wrote:
> When one connects to a database the name for the connection is the "Data Source
> Name" which is then recorded to a file that appears in the grayed Source Code
> area. For example, connecting to a database (under database tab) named Herbie
> creates a file called Herbie.asp (programming in VB Script). This file is then
> saved to a directory off the root called Connections.
>
> How do we take an existing Connections file and tell dreamweaver to
> incorporate it into a given page without going through the Database tab process?
>
> Any input would be appreciated. Thanks!

This connection information is added to a page via a server side include. If you add a recordset to a page, at the top of that page will be an include that points to the Herbie.asp file, it'll look something like this:
<!--#include file="Connections/Heribe.asp" -->
Simply adjust the path to the include to be relative to the file you're working with. If your include uses "virtual" instead of "file" for the include, then the path should be root relative.

--
Danilo Celic
| http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 11, 2009 Jan 11, 2009
Danilo,

Thanks for the reply.

For other readers that might have a similar problem, here is a link to the docs that tells one how to set things up: http://livedocs.adobe.com/dreamweaver/8/using/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs...

I think I need to be a little more specific so as to define the environment I'm working with. It's Vista with IIS7 installed. I can and did setup the connection as you mentioned in the reply. Sure does work. However, when I tried to upload those files it was one error right after another. I eventually discovered, by trial and error, what the solution was.

The problem was determining the connection string, not on the local system, but the hosting company - GoDaddy. To do that, one needs to figure out where ones account directory is to write the path info to the database. I modified the herbie.asp connection string that dreamweaver created to the following:

<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="true"
' Catalog=""
' Schema=""
' The lines above were created by dreamweaver
dim oConn
dim db_path
db_path = "d:/hosting/myaccountdirectory/access_db/TheDatabaseToConnectTo.mdb"
Dim MM_Herbie_STRING
MM_Herbie_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db_path
Set oConn = Server.CreateObject("ADODB.Connection")
%>

Now perhaps to the casual observer the first question might be, where and how did he come up with db_path string? Is it the old "Watch me pull a rabbit out of my hat" thing? Well, if you need to do this part yourself, copy that info and comment out the "d:/hosting..." line and then upload the file and test it. You won't see your page but you'll see the error that's generated. That error tells you the path that the hosting company is looking for. Then change that info in your own file to that of the reported error.

Now after all that work, which took more hours than I care to think about a problem in one sitting, I wanted to have that file info available to other pages I need to design.

One simply cannot type the connection string shown above in the creation process for connecting a recordset. Dreamweaver barks at you for even trying.

Adding the #include file manually in source? Love to. I created a blank page for VBScript and then saved the html as an asp page. Here is the source code that anyone can generate:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

Where in this source would I include the herbie.asp file. Would it appear under the tab with source code (in design view)?

Here is a code snip that does work and was setup by using local connections so that dreamweaver could set up herbie.asp.

<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="/Connections/Herbie.asp" -->
<%
Dim rsRefOnFile
Dim rsRefOnFile_cmd
Dim rsRefOnFile_numRows

Set rsRefOnFile_cmd = Server.CreateObject ("ADODB.Command")
rsRefOnFile_cmd.ActiveConnection = MM_Herbie_STRING

But the problem is, how do I attach say herbie.asp to a blank page so that dreamweaver knows about the included file? Is there a way to make dreamweaver understand the connection string that I need: MM_Herbie_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & db_path?

Right now I have to develop local recordset connections and let dreamweaver create the herbie.asp. I then have to redo the contents of herbie.asp and upload the file. Lots of work for a few pages and if I need to edit something down the road, the odds that I remember this might be slim to none.

I hope I was not to detailed in this but gave enough info for others who might come across the same situation.

Thanks again for the input. Any further suggestions?

Wayne
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 11, 2009 Jan 11, 2009
WAStrnad wrote:
> Right now I have to develop local recordset connections and let dreamweaver
> create the herbie.asp. I then have to redo the contents of herbie.asp and
> upload the file. Lots of work for a few pages and if I need to edit something
> down the road, the odds that I remember this might be slim to none.

If you have two copies of herbie, one local and one remote, upload the remote one so that your site uses that as the include, and use the local one for editing and modifying the pages local (assuming you have a recent enough copy of the MDB local as well) then as long as you don't upload the local one on top of the remote on, you wont' need to swap them out.

I do this for a couple of sites. Plus I always have a backup of the remote connection file named using connectionNameRemote.asp just in case I some how overwrite the remote one I can upload the backup up copy and rename it and we're back in action.


--
Danilo Celic
| http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 13, 2009 Jan 13, 2009
Danilo,

Thanks for the feedback and suggestions. I do keep an extra copy of the file tucked away. However, within dreamweaver when one does setup the site for remote connection and then makes a modification to the web page, dreamweaver will automatically put the local version up to the remote hosting service. Apparently one will always need to upload the tucked away copy and overwrite the local that was forwarded to the connections directory.

Thanks again for the input.

Wayne
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 13, 2009 Jan 13, 2009
WAStrnad wrote:
> Danilo,
>
> Thanks for the feedback and suggestions. I do keep an extra copy of the file
> tucked away. However, within dreamweaver when one does setup the site for
> remote connection and then makes a modification to the web page, dreamweaver
> will automatically put the local version up to the remote hosting service.
> Apparently one will always need to upload the tucked away copy and overwrite
> the local that was forwarded to the connections directory.

Dreamweaver will only put the connection file with an uploaded file if you have it set to do this. It does not do that by default. When you upload a file there is a dialog that appears that asks you if you want to upload dependent files, if you click Yes, then any dependent files, including the connection file will be uploaded. There is also a Do not ask again on that dialog. If you checked that box and clicked Yes, then Dreamweaver will always upload the dependent files along with uploaded files.

You can check your settings by going to Edit->Preferences (Dreamweaver->Preferences on Mac), move to the Site category, and look at the Dependent files options. If you have the "Prompt on put/check in" option unchecked, then Dreamweaver will not ask you if you want to put dependent files, and again if you had answered Yes when Dreamweaver asked you about dependent files, it will always upload the dependent files.

You'll want to uncheck that box, click OK to save the preference and then upload one of your files that contains a link to your connection file, Dreamweaver should prompt you to upload dependent files. Click No. If you check the do not show again prior to clicking No, Dreamweaver wil never ask you if you want to upload dependent files.

The downside to not uploading dependent files is that you have to be careful to upload all of your files when you make changes to them rather than leaning on Dreamweaver to upload them for you automatically. But for having multiple connections, one for remote and one for local, you will get hurt if you do upload dependent files automatically, so you have to pick your poison.

Note: It's also possible that the Cloaking feature may assist in this issue as well. Cloaking is supposed to prevent some operations including GET/PUT from affecting certain files/folders. You have to enable cloaking on a per site basis. Open up a site (Site -> Manage Sites, select your site, and click Edit. Move to the Cloaking category, and check the Enable cloaking option. Click OK, then click Done. Now you can right click on the Connections folder and go to Cloaking -> Cloak. You should now see a red line strike through the Connections folder. This should prevent the files in the Connection folder from being uploaded during "normal" GET?PUT operations. I put normal in quotes, because you can still GET?PUT the files in the Connection folder if you need to by selecting the folder itself and clicking the GET/PUT buttons, or by selecting specific files within the Connections folders and GET/PUT them.



--
Danilo Celic
| http://blog.extensioneering.com/
| WebAssist Extensioneer
| Adobe Community Expert
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 16, 2009 Jan 16, 2009
LATEST
Thanks again for the feedback. Highly informative!

I've only had Dreamweaver a couple of weeks since cs4 was delivered and I find some of it rather confusing or I should say, different from what I'm used to using. I've crashed Fireworks a couple of times after designing something in it, exporting to html with images and then loading the page in Dreamweaver; it was after I right-clicked to edit page in Fireworks and returned by clicking "Done" in FW that the crash occurred.

Anyway, thanks for the help and suggestions. Much appreciated.

Wayne
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines