Connecting to your database with a DSN-less connection

TOAST.net supports the use of MS SQL, MySQL and MS Access databases. Below are samples on how to connect to your database using a DSN-less connection. This is the fastest method to connect to your database. If your application requires you to use a DSN please email your request to support@toast.net.

Sample Connection Strings

  • DSN-less connection for MS SQL"Provider=SQLOLEDB; Data Source=mssql.megasqlservers.com; Initial Catalog=YOURDATABASENAME; User ID=YOURUSERNAME; Password=YOURPASSWORD"
  • DSN-less connection for MySQL"Driver={MySQL}; Server=sqlc2.megasqlservers.com; DATABASE=YOURDATABASENAME; UID=YOURUSERNAME; PWD=YOURPASSWORD;"
  • DSN-less connection for MS Access"PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("../databases/YOURDATABASE.mdb")
    Defining Paths:
    Server.MapPath("/") equates to "\domain.com\public\"
    Server.MapPath("/images") equates to "\domain.com\public\images"

Making a database connection and viewing data

Set conn = Server.CreateObject("ADODB.Connection")

Conn.Open {insert your DSN-less connection}

Set ObjRs = Server.CreateObject("ADODB.Recordset")
strSQL = "select columnname from table"
objRS.open strSQL, Conn
Do While Not objRs.EOF
response.write(objRS("columnname") & "<br>")
objRS.MoveNext
Loop
conn.close
set conn = nothing