Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Join Date
    Mar 2007
    Posts
    9

    Question Unanswered: Dreamweaver to Access Database Connection String

    Hi guys.

    I have got myself some free web space at prohosting.com I have managed to upload some files through dreamweaver to the space using the ftp function. My next step is trying to create a connection to my Access Database.

    I have created a file called Database on the server, and have placed my database in here. I have then tried to create a connection string to this by trying variuos connection strings, but i keep getting "unidentified error occoured"

    I would appreciate any help.

    Thanks

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10

  3. #3
    Join Date
    Mar 2007
    Posts
    9
    Hi, i am still a little confuse though. How do i find out the path of my database held on the server? At the moment i right click on it and view the URL. Is this the right way?

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    That sounds good to me...

    Remember, if the webpage using the database is in the same folder then you can simply use the filename.
    If it's in a subfolder to the webpage then you can use "\sub folder\databasename.mdb"
    George
    Home | Blog

  5. #5
    Join Date
    Mar 2007
    Posts
    9
    Hi. I have tried everything and have still had no luck. Just to let you know, i am using the dreamweaver custom connection string window to try and connect. These are the strings i have used so far

    "sDSN="Provider=Microsoft.Jet.IKEDB.4.0;Data
    Source=\Database\database.mdb"

    "driver={microsoft access driver(*.mdb)}; dbq=/Database/database.mdb"

    The ftp testing server works fine, so i know all those setting are correct. My database is called Database.mdb held in a file called Database. Which is a sub directory of where my main site is held.

    Really struggling with this.

    Thanks

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I'm afraid my experience of ASP is fairly limited but let's see what we can achieve...
    Give this code a bash:
    HTML Code:
    <%
    Dim conn
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.Open "Database/database.mdb"
    
    ....
    
    conn.close
    Set conn = Nothing
    %>
    Let me know how it goes.
    Last edited by gvee; 03-16-07 at 10:16.
    George
    Home | Blog

  7. #7
    Join Date
    Mar 2007
    Posts
    9
    Hi, thanks for quick reply. Where do i need to put that code exactly? Up until now i have simply been using dreamwevaer and inputting the connection string into a text box where it prompts me to.

  8. #8
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I have stumbled across this article which explains how to use dreamweaver to connect to an access database.

    As for where to put that code - anywhere you want to use that datasource!

    Here's an extended example
    Save this code as an asp page (make sure you change the path to your database and table name to your own) and then run it and view the results.
    HTML Code:
    <html>
    <body>
    <%
    dim conn, rs, x
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open "<path to your database>"
    set rs = Server.CreateObject("ADODB.recordset")
    rs.Open "SELECT * FROM <YourTable>", conn
    do until rs.EOF
      for each x in rs.Fields
        Response.Write(x.name)
        Response.Write(" = ")
        Response.Write(x.value & "<br />") 
      next
      Response.Write("<br />")
      rs.MoveNext
    loop
    rs.close
    conn.close
    Set rs = Nothing
    Set conn = Nothing
    %>
    </body>
    </html>
    George
    Home | Blog

  9. #9
    Join Date
    Mar 2007
    Posts
    9
    Nope, still not working. No idea what it is. Think it must be a really simple porblem, just doing my head in! Always errors and says unidentified error.

  10. #10
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    HTML Code:
    <% language="VBScript" %>
    <% Option Explicit %>
    <html>
    <body>
    
    ....
    I think the option explicit will help with the debug.
    What did you change <path to your database> and <YourTable> to?
    George
    Home | Blog

  11. #11
    Join Date
    Mar 2007
    Posts
    9
    Wait a minute! Think i just found the problem. My server does not allow the file extension .asp. therefore i am guessing this is why it is erroring! Does anybody know of any good free servers that allow .asp pages and supports a ftp facility?

  12. #12
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Haha, after all that eh?
    Don't suppose you are running windows 200 Pro/Xp Pro/Vista? If so there's something called IIS which comes with it that works as like an emulation server for ASP pages. (useful for practice!).
    And to answer your question - no, I'm afraid I do not know of any FREE ones that allow asp pages.
    George
    Home | Blog

  13. #13
    Join Date
    Mar 2007
    Posts
    9
    Right. Next problem encountered.

    I have now got my self some new space. Which accepst access databases and asp pages. They even gave me a connection string to use. Which followed the lines of.

    "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("Database\TestDB.mdb")

    I adapted this to the correct folder and file. However, when i ran the code in dreamweaver, it errord with "HTTP Error Code 400 Bad Request"

    I then decided to try and use the exact location of my database. So i made a map path page which returned the following address of my database

    e:\xxxxxxx\LocalUser\xxxxxxx\xxxxxxx.somee.com\dat abase\database.mdb

    So i am now confident i have the exact location. Can anyone help with why it is erroring when i click "test connection"

  14. #14
    Join Date
    Mar 2007
    Posts
    9
    Quote Originally Posted by georgev
    I have stumbled across this article which explains how to use dreamweaver to connect to an access database.

    As for where to put that code - anywhere you want to use that datasource!

    Here's an extended example
    Save this code as an asp page (make sure you change the path to your database and table name to your own) and then run it and view the results.
    HTML Code:
    <html>
    <body>
    <%
    dim conn, rs, x
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open "<path to your database>"
    set rs = Server.CreateObject("ADODB.recordset")
    rs.Open "SELECT * FROM <YourTable>", conn
    do until rs.EOF
      for each x in rs.Fields
        Response.Write(x.name)
        Response.Write(" = ")
        Response.Write(x.value & "<br />") 
      next
      Response.Write("<br />")
      rs.MoveNext
    loop
    rs.close
    conn.close
    Set rs = Nothing
    Set conn = Nothing
    %>
    </body>
    </html>
    Just used that, and it comes up with a list of items in a table in my database. So the connection is fine. Its just dreamweaver errors when i try and use the connection string. Any ideas why??

  15. #15
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Because WYSIWYG editors are poop
    If you know the above connection string is working then just use that - don't try and re-invent the wheel!
    and good luck with the project!
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •