SQL Anywhere, on-demand edition Web Services
Module 15 - Connecting to Databases using HTTP or HTTPS Web Services
In this module, you will learn how to connect to your databases in the on-demand edition cloud via an HTTP or HTTPS web service. For information on using SQL Anywhere and web services, refer to the documentation at: http://dcx.sybase.com/index.html#1201/en/dbprogramming/http-web-services.html.
Your cloud should have the basic architecture set up with at least a few tenant databases running. This module requires that you have the SQL Anywhere Developer Edition installed.
Connecting to a Running Database using an HTTP or HTTPS web service
A database in the cloud can be connected to via a web service using either HTTP or HTTPS. With the cloud’s automatic connection redirection, the minimum parameters required are the host name and database name. For high-availability and read-only scale-out systems, which were discussed in an earlier module, you can also connect to the mirror, copy or scale-out copies of the databases.
To connect to an HTTP or HTTPS web service:
- You will need the name of the web service, the name of any host running in the cloud, along with its HTTP or HTTPS port number, and the database name. Additionally, you will need login credentials for the database if your web service requires authentication.
- The URL to access the web service is similar to: http://<hostname>:<http(s)-port>/<database-name>(<nodetype>)/<web-service-name>. The NodeType parameter is optional. When unspecified, the connection will be made to the PRIMARY database. Other options include MIRROR, COPY, and READONLY.
For example, if the demo database has a web service called Contacts, which queries the employees table, the URL to connect to the mirror copy of the tenant would be http://MYCLOUD-1/demo(mirror)/Contacts.
For more information, refer to http://dcx.sybase.com/index.html#cloud100/en/dbcloud/connect-db-web-service.html.