Blue Reef Technical Support ResellersAbout Blue Reef Consulting, Inc.

EcommerceSearch
Return to Blue Reef Virtual Servers Home Page
Order virtual servers, software, computers, and more!
Return to Blue Reef Main Home Page
Specials
Site Map
Development Suites for your Virtual Server.



Virtual Servers Home Page
Virtual Server Support
Virtual Server Addons
Web Site Development Suites
Active Server Pages
Web Site Development Suites OverviewActive Server Pages Overview
Active Server PagesChili!Soft ASP
Chili!Soft ASP Advanced Configuration Options
Chili!Soft and Databases
Apache::ASP
Request help using our Problem Tracking System
Order a Blue Reef Virtual Server now!


Chili!Soft ASP and Databases

The Chili!Soft ASP engine is designed to make connecting to a database easy. You can connect to a remote database, or to a MySQL or PostgreSQL database running on your Solaris Virtual Server.


Connecting to your Database
There are two basic methods for connecting to a database. One method uses a DSN (Data Source Name) stored on your Virtual Server which contains the connection information. DSNs are potentially insecure because they store the database's user and password in a file on the server that can be accessed by others if they know where to look.

For more secure connections, you can use a DSN-less connection. This stores the database connection information in the ASP source document, which can not be viewed or used by others.


Connecting with a DSN
Chili!Soft stores its DSN information in the ~/usr/local/casp/asp-apache-3000/odbc.ini file. This file also contains templates Chili!Soft uses when creating DSN-less connections. An example of a DSN for a local MySQL database might look like this:
[mydatabase]
Driver=/usr/local/casp/odbc/opensource/lib/libmyodbc.so
Server=localhost
Port=3306
Database=mydatabase
User=myuser
Password=Shh!-dont_tell!
Option=
UseCursorLib=1
The DSN name, enclosed in square brackets, should be the same as the name of the database you are accessing. If you are connecting to a remote database, you would replace the value localhost in the Server= line with the name of the server where the database is (or the TNS name for Oracle).

Once you have created your DSN and saved it in the odbc.ini file, you can then access the database by creating a Connection String in your ASP code. You can also create a FileDSN, which contains a DSN stored in a file other than the odbc.ini file.

The connection string for a DSN connection would look similar to either of these:

connect_string = "dsn=[mydatabase]"

connect_string="FileDSN=[/usr/local/etc/httpd/vhosts/mysubhost/MyDSNfile.dsn]"



DSN-less Connections
If you want to create a DSN-less connection, you would need to include the same connection information from the DSN in the Connection String. A DSN-less connection string might look like the following:

connect_string = "Driver={Mysql}; Server=localhost; Database=mydatabase; UID=myuser; PWD=Shh!-dont_tell!"


More Information
See the Chili!Soft ASP Documentation, chapter 4, in the section "Connecting to a Database" for more information on using databases with your ASP applications.
SEE ALSO:

Advanced Chili!Soft ASP

About Chili!Soft

About ASP

Server Add-ons

Amazon.com logo
Search for :
Enter keywords...