LWD Internet ... connecting business ... cutting costs ...Accept Credit Card Payments From Your Website
 Home | Domain Names | Web Hosting | E-commerce | Support | Web Design

Using databases with your Windows 2000 web hosting account

This document provides basic information about the databases we support. We have provided information for installing and using a Microsoft Access database on your Windows 2000 web hosting account and for accessing it using Active Server Pages. We have also provided a demonstration ASP script which you may use to test that database connections are working on the server.

Please note that, as with other technologies, support is limited to ensuring that database connections are working on the web server. Building your databases and accessing them from your web site is your responsibility.

Databases supported
We currently support and provided Data Source Name (DSN) connections for the following databases:

  • Microsoft Access
  • DBase
  • Excel
  • Paradox
  • Plain Text
  • Visual FoxPro
  • You may connect to these using DSN-less connections at no extra cost, or with a system DSN for an additional annual set up fee. LWD Internet recommend that you use DSN-less connections, as this allows you to use multiple databases at no additional charge, and allows you to change database names more easily than with a system DSN.

    You are free to try and connect to other databases, but we cannot guarantee that a connection can be made, nor can we provide any form of support for those databases.

    Data Source Names (DSNs)
    Whether you use a DSN or a DSN-less connection to your database is entirely up to you. There are no definitive agruments to say whether DSN or DSN-less connections are better or faster.

    You may request the set up of a database DSN on your account by with the database name (database.mdb), database type (Access / DBase), the Data Source Name (mydatabase) and the location of your database (www.mydomain.com/cgi-bin/database.mdb). Please remember to give us your domain name, your hosting account number and password with your enquiry.

    Accessing your database
    There are many ways in which you can use server side scripting to access your database from your web or WAP site. The example script below shows just one method of connecting to and reading from a Microsoft Access database using Active Server Pages and a system DSN. Other methods can be found on the websites listed in our useful websites page.

    <%@ language=VBSCRIPT%>

    <%
    set rs=Server.CreateObject("adodb.Recordset")
    connect="DSN=DSNName"
    sqlstmt = "SELECT * from TableName"
    rs.open sqlstmt, connect

    if rs.eof then
    response.write "No records found."
    response.end
    else
    response.write "<br>"
    response.write "<h1>Output from database:</h1>"
    response.write "<hr>"
    response.write "<br>"
    response.write "<table>"
    %>

    <table border="1" cellpadding="0" width="100%">
    <tr>
    <td width="20%" align="center">
    <p align="center"><b><u>ID</u></b></td>
    <td width="20%" align="center"><b><u>First Name</u></b></td>
    <td width="20%" align="center"><b><u>Last Name</u></b></td>
    <td width="20%" align="center"><b><u>Telephone</u></b></td>
    <td width="20%" align="center"><b><u>Comments</u></b></td>
    </tr>

    <%
    do while not rs.eof

    id = rs("id")
    firstname = rs("firstname")
    lastname = rs("lastname")
    telephone = rs("telephone")
    comments = rs("comments")


    response.write "<tr>"
    response.write "<td>" & id & "</td>"
    response.write "<td>" & firstname & "</td>"
    response.write "<td>" & lastname & "</td>"
    response.write "<td>" & telephone & "</td>"
    response.write "<td>" & comments & "</td>"

    rs.movenext
    loop

    response.write "</table>"

    rs.close
    set connect=nothing
    set rs=nothing
    end if

    %>

    Testing your ODBC DSN connection
    You should use the simple script above to test that DSN connections are working on your server and that your database is properly accessible. You will need to change DSNName in line 5 to the name of your database. For example, if your database is saved as mydata.mdb then line 5 will read connect="DSN=mydata".
    You will also need to change TableName in line 6 to the name of a table in your database. For example, if you wish to use a table called Table1, then line 6 will read sqlstmt = "SELECT * from TableName".

    You should also change the field names in lines 24 to 35 to match the fields in your specified table, adding or removing fields as required. You should then place the script and your database in the location specified when you set up your ODBC DSN. Finally, create an HTML page with a link to the script and click on the link. The ASP script should then read the database and display all the data from the specified table, or if you have speciifed an empty table, then script should display 'No records found'. Either of these results indicate your ODBC DSN connection is working correctly.

    Offline Testing
    Remember that you can also test your script and database offline in Windows 98+ by installing Personal Web Server (PWS). This can dramatically speed up testing. If your script connects to your database offline, then it should also work online. To test offline, you will need to set up a DSN from the ODBC Data Sources in the Windows Control Panel. Remember to use the full path and filename for your database without using the filename extension (.mdb).

    Troubleshooting and Error 80004005
    Error 80004005 is a very common error which occurs when the server is unable to access the database for some reason. If you receive this error, you should do the following:

    1. Check that the database is in the correct location and that your database is named correctly, then try again.
    2. Check that you have set the correct run permissions in the database. To check this in Microsoft Access 97, check Tools => Options => Tables/Queries, and make sure Run Permissions are set to Owner's. Also check that no passwords are set.
    3. Check your connection string is correct. If in doubt, use the connection string as provided in the example code above.
    4. Check the Microsoft Knowledge Base at http://support.microsoft.com/
    5. If you still haven't cured the problem by this stage, create a new database with the same name as the database you have been having difficulty with, and test it using our example script above.
    6. If you still have no luck, contact with full details of your problem. We will then check your DSN connection is set up correctly and that database connections are working correctly.

    Please note that our support extends to ensuring that database facilities are working, but not to the setting up of your databases and connecting to them with scripts.

    More Information
    You can find many other database connection examples on the websites listed in our useful websites page.