SheerPower® 4GL
A Guide to the SheerPower Language


Previous Contents Index

17.1.2 Accessing ODBC with SheerPower

To access an ODBC database with SheerPower, you just specify the table to access inside the database in the OPEN STRUCTURE statement of the source code.

For example, to access the Contacts table inside the MyContacts.mdb database:

Example 17-9 Accessing ODBC Database in SheerPower OPEN STRUCTURE Statement

  open structure con: name 'contacts in mycontacts'
  extract structure con       
    sort ascending by con(LastName) 
  end extract 
  print 'Contact List' 
  print 
  for each con 
    print con(FirstName); ' '; con(LastName), con(MobilePhone), con(EmailName) 
  next con 
  close structure con 
  end 
  
  
  
Contact List 
 
Steven Buchanan     (206) 555-1856      StevenB@hfs.com 
Nancy Davolio       (425) 555-9811      nancy@anywhere.com 
Andrew Fuller       (206) 555-6666      andrewf@anywhere.com 
Janet Leverling     (206) 555-7777      janetl@anywhere.com 
Margaret Peacock    (206) 555-5555      margiep@anywhere.com 

17.2 Accessing Password Protected ODBC Databases

If the ODBC database you are using requires a username and password to access it, the following format is used in SheerPower:


  ?user=xxx&password=yyy 

The code could look like the following:


  dbuser$ = 'dbadmin' 
  dbpass$ = 'dbpassword' 
  mycontacts$ = 'Contact in MyContact?user=' + dbuser$ + '&password=' + dbpass$ 
  open structure d: name mycontacts$ 


Chapter 18
SheerPower Internet Services (SPINS) Webserver

SheerPower Internet Services (SPINS) Webserver comes bundled with SheerPower 4GL. The SPINS webserver allows anyone to make web-based applications, even on their own local computers not connected to the Internet, without having to purchase a webserver license. And, of course, the SPINS webserver is EASY to install and use!

For more on writing network and web-based applications with SheerPower 4GL, see Section 19.3, Webserver CGI Interface.

18.1 SPINS Webserver Location and Directory Structure

By default, the SPINS webserver (spins_webserver.exe) is installed to the following directory:

Example 18-1 SPINS Location

  \sheerpower\sphandlers\

This will assume that the root folder is:

Example 18-2 Default Root Folder Location

  \sheerpower\sphandlers\wwwroot\

SPINS_webserver expects the directory structure to be:

Example 18-3 Expected Directory Structure

  [wherever SPINS_webserver.exe is] 
            | 
         [wwwroot]--> things like INDEX.HTML 
          |     | 
     [images] [scripts] 

If you are replacing IIS with the SPINS_webserver, you would do the following inside the Command Prompt program:

Example 18-4 Replacing IIS with SPINS

  c:>  \sheerpower\sphandlers\spins_webserver.exe -wwwroot "c:\inetpub\wwwroot"

The -wwwroot option tells the SPINS webserver where the root folder is.

18.1.1 Stop Microsoft IIS Webserver

To run SPINS webserver, the Microsoft IIS webserver must be stopped or a different port specified for either webserver. Before running SPINS webserver for the first time:

To specify a different port number for SPINS to use, see Section 18.1.3, Specify a Different Port Number.

18.1.2 Test SPINS_Webserver

To test SPINS webserver:

This will open up the .HTML file located in:


  sheerpower/sphandlers/wwwroot/index.html 

18.1.3 Specify a Different Port Number

To tell the SPINS webserver to use a different port number from the default port 80, start it from the Command Prompt program or with a PASS NOWAIT statement within your program using the following syntax:

Example 18-5 Syntax to Change Port Number Used

  spins_webserver -port nn

For example, to change from the default port 80 to port 8080:


  spins_webserver -port 8080

to use port 8080.

Running SPINS and IIS Simultaneously

If you need to utilize some of the IIS facility, you can set the IIS webserver to use port 8080 and the SPINS websever to use port 80 (or the other way around). Both webservers can co-exist this way.

18.1.3.1 Run Web-based Applications on Multiple Ports

To run web-based applications on multiple ports, the following syntax is used:

Example 18-6 Syntax to Specify Multiple Ports

  spins_webserver -port 80 -wwwroot c:\root1 -port 8080 -wwwroot c:\root2 

Each -port nn lets you specify a port. In the above example, we are listening on TWO ports:


  80  and  8080 

18.1.4 Specify Any Root Folder

You can tell the SPINS webserver to use a specific root folder by performing the following command inside the Command Prompt program:

Example 18-7 Specify SPINS webserver root folder

  spins_handler -wwwroot "c:\inetpub\wwwroot" 

Another example would be:


  SPINS_webserver -wwwroot "c:\myplace\stuff\" 

This would mean than an INDEX.HTML file would be in:


  c:\myplace\stuff\index.html 

18.1.5 SPINS Webserver Options

For a list of options (like specifying the wwwroot folder), type the following command inside the Command Prompt program:

Example 18-8 SPINS Webserver Options Command

  C:\sheerpower\sphandlers>  spins_webserver -?

The command will return the following options (subject to change):


  C:\Documents and Settings\User>c:\sheerpower\sphandlers\spins_webserver -? 
  SheerPower InterNet Services Web Server SPINS_WEBSERVER V00.00.060 
  Copyright (c) 2005 Touch Technologies, Inc. - Sat, 17 Sep 2005 19:05:23 
 
  spins_webserver [-option value] [-nextoption value] ... 
     -? or -help                FOR this display 
     -ipaddr xxx.xxx.xxx.xxx    TO specify AP address to listen on 
     -port  ##                  TO specify port to listen on 
     -https ##                  TO specify port to listen on 
     -cafile filespec           FOR Certificate Authority File 
     -certfile filespec         FOR Certificate File 
     -keyfile filespec          FOR Private Key File (default = certfile) 
     -keypass password          FOR Private Key File Password 
     -recvbuf_def ###           TO specify receive buffersize 
     -recvbuf_max ###           TO specify MAXIMUM receive buffersize 
     -sendbuf_def ###           TO specify send buffersize 
     -threads ##                TO specify number of threads to use 
     -virtual hostname pathname TO specify a virtual host and wwwroot 
     -wwwroot pathname          TO specify the wwwroot directory 
     -flags [NOEXCLUSIVE][:DISPLAY_GET][:DISPLAY_PUT] 
            [:DISPLAY_RECV][:STATUS_CONN][:SSL_ERRORS] 
            [:DEBUG][:MISC_DEBUG] 

-port ## and -https ##

Any parameters before a -port or -https will become the global defaults.

Those parameters after the -port or -https will be specific to that port.


Previous Next Contents Index