Chili!Soft ASP + Microsoft Access How-To for the RaQ3 & RaQ4
Transcription
Chili!Soft ASP + Microsoft Access How-To for the RaQ3 & RaQ4
Chili!Soft ASP + Microsoft Access How-To for the RaQ3 & RaQ4 This is a step-by-step document on how to create a Microsoft Access DSN for use in a ASP page. Each step will be accompanied by a screenshot to illustrate the procedure. There are separate sections for the RaQ3 and RaQ4 in each step of the procedure. Instructions for either the RaQ3 or RaQ4 will begin in BOLD GREEN text. Microsoft databases cannot run on Cobalt servers. This is not a limitation of Cobalt products but rather a deficiency in those applications. MS Access and MS SQL Server can only run on Windows platforms. This is a HOW-TO for MS Access only. Chili!ASP ships with a direct ODBC driver for MS SQL Server 7 which negates the need for Step 1 of this document. In fact, the procedure to create a DSN for MS SQL Server 7 is almost the same as the HOW-TO for MySQL. Step 1 On your Windows OS with your database installed, you will need to install this program. (download this zip file and run the setup program - if running under NT or Windows 2000, you will need administrator rights to install the program) - See Step 13 on how to uninstall this Sequelink software. When prompted for the Serial and Key, enter EVAL under Serial. To avoid the 30 day evaluation period, contact Chili!Soft Support at tech@chilisoft.com to fully unlock the product. It will auto-detect the databases on your system (in this case, Access) and show the screen below for Access: Remember the name (SLSocket) given here - it will be used later on in this HOW-TO. The defaults are usually fine. Click OK and it will complete the installation. Other steps that need to be performed (assuming it is a Windows NT 4.0 machine): Enable access to the OS via a pre-defined user account with appropriate rights to read/write/execute in the directory where the Access MDB files are located. Consult your nearest NT/Win2000 Systems Administrator for help if you are unsure about this process. In my example below, I've shared D:\Temp and put the database files in D:\Temp\MSAccess. Step 2 For a RaQ3, log into the Web Interface and view the Install Software menu. Click on the Chilisoft ASP link listed under Software on the Cobalt Server. For the RaQ4, log into the Web Interface and view the Services menu under Control Panel. Click on Parameters of the ASP Administrative Server. IMPORTANT NOTE If the Parameters option is not available, you need to enable the checkbox (and don't forget to Save Changes) to start the ASP Administrative Server first. Make sure ASP is enabled for the main site of the RaQ4. Step 3 For a RaQ3, click on the link to the ASP Administration Console, as shown below. You will then be prompted to log in (see screenshot below) - the default login name is admin the default password is root For the RaQ4, you will be prompted to log in. The login user name is admin - the password is the same as your Cobalt admin password. Step 4 For a RaQ3, click on the Manage a server link. Next, click on the properties link. Step 5 For a RaQ3, click on the Databases link. For a RaQ4, click on the Databases link. Step 6 For a RaQ3, click on Add New DSN. For a RaQ4, click on Add New DSN. Step 7 For a RaQ3, select SequeLink and click Next. For a RaQ4, select SequeLink and click Next. Step 8 For a RaQ3, enter a DSN name and description and click Next. For a RaQ4, enter a DSN name and description and click Next. Step 9 For a RaQ3, enter the details of the DSN and click Next. For a RaQ4, enter details of the DSN and click Next. The LogonID and Password fields can be ignored for now - unless you enabled them for your database, then enter the proper identification here. The Database field is the full path and filename of the Access MDB file. e.g. C:\Access\Example.mdb The syntax of the Database field follows standard Microsoft naming conventions - as in the backslash (\) instead of the forward slash (/) in directory names as well as defining which drive it is on. You need to give a name for the SQLnkDSN - call it anything you want, with no spaces or special characters. Remember this value as you will need it later on. This will lead to the following screen to complete the Add New DSN process. Step 10 For a RaQ3 and RaQ4, telnet into your Cobalt box, log in as admin and type "su -" to log in as root. Next, type "cd /home/chiliasp/asp-apache-3000" The program you want to run is called setsqlnk - type "./setsqlnk" Select 2 to Add a New entry. It will prompt for a name. This value directly corresponds to the SQLnkDSN entry in Step 7. In my example, it was called Access1 - so I need to call this new SQLnk entry Access1. Next, it will prompt for a description (optional) and transliteration - if you press Enter for each of these prompts, it'll accept the default values which is fine. Next, choose TCP/IP network (it is the only available choice) and enter the IP address of the Windows machine with both database and extra software installed. For Server Type, pick Windows NT. At the user prompt, enter the valid NT/Win2000 username that has rights to the machine for database access. Enter the password for the user as well. Next, select option 12 for MS Access. There is a IMPORTANT NOTE If the Access file requires a Username and Password, you will need to select option 14 (ODBC Socket). When the ASP connection string is setup, include the UID= and PWD= arguments. Enter the name of the service given in Step 1 - it defaults to SLSocket. At the database prompt, enter the path and filename to the Access MDB file. This completes the addition of the new entry. The next step is to test the connection - do so by selecting option 6. Should it fail, you can edit the entry again via option 4. If the test fails, go to your NT/Windows 2000 machine and check the Services tab in Control Panel (under Administrator Tools in Windows 2000) - make sure the SLSocket service is started. TIP Assuming you placed all your Access MDB files in the same location (directory), the creation of this SQLnkDSN need only be performed once - you can control which Access file is used via the creation of the DSN in the ASP Administrative Console (Step 9). Step 11 For a RaQ3, test the DSN you just created by clicking on test. For a RaQ4, test the DSN you just created by clicking on test. IMPORTANT NOTE On machines without the latest Chili!ASP patch, the Test DSN link will give the Failed error every time after it fails once. Either install the patch by clicking on this link (the patch is a standard PKG file that you install via the RaQ's User Interface) or restart the ASP engine each time this occurs. It is included in OS Update 1.0 for the RaQ4 and Chili!ASP Interbase Fix for the RaQ3 Step 12 For a RaQ3 and RaQ4, here is an example of the ASP code using a DSN called AccessTest. <% ConnString = "DSN=AccessTest" Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open ConnString Conn.Execute ..... .... .... Conn.Close Set Conn = Nothing %> For a RaQ3 and RaQ4, here is an example of the ASP code using a DSN called AccessTest that is password protected. <% ConnString = "DSN=AccessTest;UID=AccessUser;PWD=Password" Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open ConnString Conn.Execute ..... .... .... Conn.Close Set Conn = Nothing %> Step 13 To uninstall the Sequelink software from your Windows machine, first, stop the service that is running. Open up the registry editor and remove the following keys: HKLM\SOFTWARE\INTERSOLV HKLM\SYSTEM\CurrentControlSet\Services\SLSocket Next, delete the Program Group in the Start Menu as well as the installed software directory, usually in Program Files\SequeLink Server. Restart the box.