MARIS Side Menu

DOCUMENTATION


Database Schemas

State Database Information (members only)

Developer Information

 


 

How to Connect to the MARIS System.

Methods to get data online:

These solutions range from the most general/powerful to the simplest/least requirements.

  1. Connect your database to your webserver. Tell the GMS Lab the URL of your connection script. (more information)

    • requirements: Microsoft Internet Information Server (IIS) version 3 or greater.

  2. Let the GMS Lab make a direct connection to your remote database. (more information)

    • requirements: A database server which can support connections over the Internet (for example Oracle or MS SQL)

  3. Send copy of database to GMS Lab. We will setup the connections and serve your data from our system. (more information)

    • requirements: A database


Detailed Instructions:

Method 1.

Create an ODBC connection between your database and webserver:

  1. Open the Control Panel on your webserver.

  2. Open the ODBC manager.

  3. Click on Add... under the System DSN tab.

  4. Select the appropriate driver for your database.

  5. Pick a Data Source Name. This is important since it is the name that the MARIS connector will use to access the correct database.

  6. Fill out the rest of the form as appropriate. The details of this portion are specific to the driver used. This is where you can specify which dataset to use, security, and performance parameters. If you are unsure of how to set the fields please contact your database admistrator.

  7. Click OK.

Install the web-database connection script:

You will need to create a directory in which your web server can execute the script. You can use the standard /Scripts directory or create one specifically for MARIS. To create the directory,

  1. Create a new directory with your standard filesystem tool. I would suggest a name such as maris.

  2. Open the Internet Service Manager.

  3. Double click on the WWW service.

  4. Goto the Directories tab.

  5. Add... a new directory.

  6. Set the Directory information as appropriate.

  7. Check the Execute box in the Access information. The script will not run unless this is done.

  8. Click OK.

Copy the following file (the grey portion) into a file named maris.asp in your new directory . The file maris.asp is an Active Server Page written in Visual Basic Script.  Or download it here maris.asp.

maris.asp

<% '*** maris.asp version 1.6 (GMS Lab, University of Illinois) ***
'Error Handling
On Error Resume Next
Server.ScriptTimeOut = 80

Function CheckForErrors(objConn)
If objConn.Errors.Count > 0 Then
'**Create an error object to access the ADO errors collection
Set objErr = Server.CreateObject("ADODB.Error")
'**Declare boolean flag for critical errors
Dim blnCriticalError
'**Write all errors to the page
For Each objErr In objConn.Errors
If objErr.Number <> 0 Then
Response.Write "<br><br></td></tr></table><table border=1 align=center cellspacing=0><tr><td>"
Response.Write "<b><font color=fish size=+2>The server encountered an error.<br></b></font>"
Response.Write "The MARIS server is probably the main cause.<br>"
Response.Write "Please contact the <a href=mailto://dmjohnst@uiuc.edu>webmaster</a> with the error codes below<p>"
Response.Write "<b>NativeError:</b> " & objErr.NativeError & "<BR>"
Response.Write "<b>Description:</b> " & objErr.Description & "<BR>"
Response.Write "<b>Source:</b> " & objErr.Source & "<BR>"
Response.Write "</td></tr></table><br><br>"
blnCriticalError = True
End If
Next
'**Dereference all objects
Set objErr = Nothing
If blnCriticalError Then
Response.End
End If
End If
End Function

SQL = Request("SQL")

BeginMark = "||"
EndMark = "$$"
FieldSeperator = "##"
RecordSeperator = "@@"
%>

<%
Set DBConnection = Server.CreateObject("ADODB.Connection")
DBConnection.Open "il.maris" '*** Insert the appropriate ODBC source name ***
Set RecordSet = Server.CreateObject("ADODB.Recordset")
RecordSet.Open SQL, DBConnection, aOpenForwardOnly, , adCmdStoredProc
CheckForErrors(DBConnection)
%>

<%
If Not RecordSet.EOF Then
Do While Not RecordSet.EOF
Response.Write BeginMark
For i = 0 to RecordSet.Fields.Count - 2
Response.Write( RecordSet(i) & FieldSeperator )
Next
Response.Write( RecordSet(i) & RecordSeperator )
RecordSet.MoveNext
Loop
Response.Write EndMark
End If
RecordSet.close
DBConnection.close
Set DBConnection=Nothing
Set RecordSet = Nothing
%>

You must edit the line of this file (DBConnection.Open...). Change the name in quotes ("il.maris") to your Data Source Name (DSN) you gave your ODBC connection. Save your change. Next, copy the following file (the gray portion) into a file named rows.asp in the same directory.  Or download it here rows.asp.

rows.asp

<%'*** rows.asp version 1.1 (GMS Lab, University of Illinois) ***
'Error Handling
On Error Resume Next
Server.ScriptTimeOut = 80

Function CheckForErrors(objConn)
If objConn.Errors.Count > 0 Then
'**Create an error object to access the ADO errors collection
Set objErr = Server.CreateObject("ADODB.Error")
'**Declare boolean flag for critical errors
Dim blnCriticalError
'**Write all errors to the page
For Each objErr In objConn.Errors
If objErr.Number <> 0 Then
Response.Write "<br><br></td></tr></table><table border=1 align=center cellspacing=0><tr><td>"
Response.Write "<b><font color=fish size=+2>The server encountered an error.<br></b></font>"
Response.Write "The MARIS server is probably the main cause.<br>"
Response.Write "Please contact the <a href=mailto://dmjohnst@uiuc.edu>webmaster</a> with the error codes below<p>"
Response.Write "<b>NativeError:</b> " & objErr.NativeError & "<BR>"
Response.Write "<b>Description:</b> " & objErr.Description & "<BR>"
Response.Write "<b>Source:</b> " & objErr.Source & "<BR>"
Response.Write "</td></tr></table><br><br>"
blnCriticalError = True
End If
Next
'**Dereference all objects
Set objErr = Nothing
If blnCriticalError Then
Response.End
End If
End If
End Function

SQL = Request("SQL")
%>

<!-- #INCLUDE FILE="adovbs.inc" -->

<%
Set DBConnection = Server.CreateObject("ADODB.Connection")
DBConnection.Open "il.maris" '*** Insert the appropriate ODBC source name ***
%>

<%
Set RecordSet = Server.CreateObject("ADODB.Recordset")
RecordSet.Open SQL, DBConnection, adOpenStatic, adLockReadOnly
CheckForErrors(DBConnection)
response.write RecordSet.recordcount
RecordSet.close
DBConnection.close
Set DBConnection = Nothing
Set RecordSet = Nothing
%>

You must edit the line of this file (DBConnection.Open...). Change the name in quotes ("il.maris") to your Data Source Name (DSN) you gave your ODBC connection. Save your change. 

You need one more file.  Download adovbs.inc and store it in the same directory as maris.asp and rows.asp.

That's it! Your server is completely configured.

Test it:

Send a query to your database through this web frontend by opening the following URL from your favorite web browser. Replace the ServerURL and PathName with the appropiate information for your setup.

http://ServerURL/PathName/maris.asp?SQL=select+waterbodyname+from+infowaterbody

This should return a list of all the WATERBODYNAMEs in your database.

Tell the GMS Lab about your online presence:

Send email to the MARIS administrator which includes the full URL to your copy of maris.asp and rows.asp. The appropriate adjustments will be made on the MARIS server in short order.

Congratulations!! You are serving your own data.

(Go back to the top of the page.)


Method 2.

If you have a database server which supports remote connections and do not have access to an IIS webserver then the MARIS server can be connected directly to your database system. This process will be specific to your database server. Please contact the MARIS administrator to arrange the details of this method.

(Go back to the top of the page.)


Method 3.

Send the GMS a copy of your database either as an email attachment, ftp, or snailmail. The GMS Lab ftp site can be accessed by contacting the MARIS administrator . Put your documents in the /incoming directory and email the MARIS administrator to have your information put online.

(Go back to the top of the page.)



Email comments & suggestions to webmaster
The MARIS project @ the University of Illinois GMS Lab

NOTICE:
The MARIS project is a prototype.
Data included in the databases are real, but may not be complete.
Contact the appropriate state database
contact before using this data.
Last updated: April 13, 2006