Welcome!

Machine Learning Authors: Elizabeth White, Nate Vickery, Pat Romanski, Carmen Gonzalez, Liz McMillan

Related Topics: Machine Learning , PowerBuilder, Microsoft Cloud

Machine Learning : Article

SQL Anywhere Server and AJAX

An AJAX call using stored procedures and web services

AJAX has dominated the web space so extensively that it needs no introduction. Connecting to a server via XMLHttpRequest and making a partial page refresh is what makes this technique so attractive. However, use of these AJAX requests, although very attractive, can pose dangers as well. JavaScript acts as a vector to infect websites with worms, such as SAMY, using cross-site scripting, also known as CSS or XSS.

In a previous article - "Enabling Server data with native web service" - I explain how a web service of type HTML is created on the SQL Anywhere server, which can serve HTML pages, and that to make an AJAX call for this page from your browser, you need to make a call to the hosting domain, the SQL Anywhere Web Server.

Details of the AJAX Accessed Resource
In the cited previous article, the resource is accessed on the localhost at port 8082, or any port chosen for this purpose. To send an AJAX call you have to call this domain at the same port as required by the same origin policy, the browser security model that prohibits using the XMLHttpRequest across domains. There is even a proposal at W3C to make cross-domain access possible as there may be cases when this type of access is needed. Of course, there are workarounds even now using scripts, Flash, etc.

In the cited article the web service of type HTML called TestHtmlSvc retrieves a selected portion of the Customer's data from a table in the sample demo database. Note that the page can be called up by accessing this page at its URL, http://localhost:8080/demo/TestHtmlSvc.

In this article an AJAX call will be made to access the same resource. To make such a call, an AJAX HTML page will be created and hosted on the same server so that the boundary of the browser security model isn't trespassed.

Creating a Stored Procedure
These SQL Anywhere articles describe in great detail not only the SQL Anywhere Server and its tools but also how stored procedures are created in the SQL Anywhere Server using the Wizard as well as SQL scripts. For the procedure described in this article, the AJAX page will be created as a result of running a stored procedure.

First, a stored procedure called Sabon is created on the SQL Anywhere Server as shown in Listing 1.

Some of the HTML monitors the status of the call and information about the headers. Note that the getPage () function calls up http://localhost:8082/demo/TestHtmlSvc by making an XMLHttpRequest. The coding is quite straightforward but follows the same lines as in the article "Step by Step to AJAX." Simply stated, you create an XMLHttpRequest and access the resource by a GET method and then parse the response.

The SQL Anywhere databases' HTTP Server is the SAWebServer used in the previous article. Figure 1 shows the stored procedures on this database including the Sabon stored procedure.

Figure 1

A Web Service to Call This Procedure
After creating the stored procedure Sabon, a web service of type RAW (one of several types in SQL Anywhere) called Ajaxian is created. The details of how this is created are also explained in the cited article. Again, as in the case of stored procedures, a web service may be created using script or using the built-in wizard in Sybase Central (SQL Anywhere's graphical database administration tool). Figure 2 shows one of the screens of the wizard that is used to create the web service.

Figure 2

Figure 3 shows the web services on the SQL Anywhere server. Note that the web service Ajaxian is of type RAW, which needs no authentication with the DBA as user. Now this web service can be URL accessed as shown in Figure 4.

Figure 3

The AJAX Call
The Ajaxian web service is accessed using its URL as shown in Figure 4 - only a small portion of the returned data is captured.

Figure 4

In essence, the Ajaxian web service calls up the Sabon stored procedure, which serves up the page containing an AJAX call to the SQL Anywhere Server to retrieve the TestHtmlSvc page.

The XMLHTTPRequest's Headers, status, and state are shown in Figure 5, which is a screen capture of the displayed portion returned by the AJAX call.

Figure 5

Summary
The article shows how an AJAX call can be made to a resource on the SQL Anywhere Server using stored procedures and web services.

More Stories By Jayaram Krishnaswamy

Jayaram Krishnaswamy is a technical writer, mostly writing articles that are related to the web and databases. He is the author of SQL Server Integration Services published by Packt Publishers in the UK. His book, 'Learn SQL Server Reporting Services 2008' was also published by Packt Publishers Inc, Birmingham. 3. "Microsoft SQL Azure Enterprise Application Development" (Dec 2010) was published by Packt Publishing Inc. 4. "Microsoft Visual Studio LightSwitch Business Application Development [Paperback] "(2011) was published by Packt Publishing Inc. 5. "Learning SQL Server Reporting Services 2012 [Paperback]" (June 2013) was Published by Packt Publishing Inc. Visit his blogs at: http://hodentek.blogspot.com http://hodentekHelp.blogspot.com http://hodnetekMSSS.blogspot.com http://hodnetekMobile.blogspot.com He writes articles on several topics to many sites.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
radixweb 08/21/08 05:38:42 AM EDT

Great Post.....

Java Software Development Company.....

@CloudExpo Stories
With billions of sensors deployed worldwide, the amount of machine-generated data will soon exceed what our networks can handle. But consumers and businesses will expect seamless experiences and real-time responsiveness. What does this mean for IoT devices and the infrastructure that supports them? More of the data will need to be handled at - or closer to - the devices themselves.
Building a cross-cloud operational model can be a daunting task. Per-cloud silos are not the answer, but neither is a fully generic abstraction plane that strips out capabilities unique to a particular provider. In his session at 20th Cloud Expo, Chris Wolf, VP & Chief Technology Officer, Global Field & Industry at VMware, will discuss how successful organizations approach cloud operations and management, with insights into where operations should be centralized and when it’s best to decentraliz...
Multiple data types are pouring into IoT deployments. Data is coming in small packages as well as enormous files and data streams of many sizes. Widespread use of mobile devices adds to the total. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the tools and environments that are being put to use in IoT deployments, as well as the team skills a modern enterprise IT shop needs to keep things running, get a handle on all this data, and deli...
Grape Up is a software company, specialized in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the USA and Europe, we work with a variety of customers from emerging startups to Fortune 1000 companies.
The 20th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held June 6-8, 2017, at the Javits Center in New York City, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Containers, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportunity. Submit your speaking proposal ...
Financial Technology has become a topic of intense interest throughout the cloud developer and enterprise IT communities. Accordingly, attendees at the upcoming 20th Cloud Expo at the Javits Center in New York, June 6-8, 2017, will find fresh new content in a new track called FinTech.
SYS-CON Events announced today that CollabNet, a global leader in enterprise software development, release automation and DevOps solutions, will be a Bronze Sponsor of SYS-CON's 20th International Cloud Expo®, taking place from June 6-8, 2017, at the Javits Center in New York City, NY. CollabNet offers a broad range of solutions with the mission of helping modern organizations deliver quality software at speed. The company’s latest innovation, the DevOps Lifecycle Manager (DLM), supports Value S...
SYS-CON Events announced today that Interoute, owner-operator of one of Europe's largest networks and a global cloud services platform, has been named “Bronze Sponsor” of SYS-CON's 20th Cloud Expo, which will take place on June 6-8, 2017 at the Javits Center in New York, New York. Interoute is the owner-operator of one of Europe's largest networks and a global cloud services platform which encompasses 12 data centers, 14 virtual data centers and 31 colocation centers, with connections to 195 add...
Automation is enabling enterprises to design, deploy, and manage more complex, hybrid cloud environments. Yet the people who manage these environments must be trained in and understanding these environments better than ever before. A new era of analytics and cognitive computing is adding intelligence, but also more complexity, to these cloud environments. How smart is your cloud? How smart should it be? In this power panel at 20th Cloud Expo, moderated by Conference Chair Roger Strukhoff, pane...
SYS-CON Events announced today that Hitachi, the leading provider the Internet of Things and Digital Transformation, will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. Hitachi Data Systems, a wholly owned subsidiary of Hitachi, Ltd., offers an integrated portfolio of services and solutions that enable digital transformation through enhanced data management, governance, mobility and analytics. We help globa...
SYS-CON Events announced today that Grape Up will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct. 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Grape Up is a software company specializing in cloud native application development and professional services related to Cloud Foundry PaaS. With five expert teams that operate in various sectors of the market across the U.S. and Europe, Grape Up works with a variety of customers from emergi...
@ThingsExpo has been named the Most Influential ‘Smart Cities - IIoT' Account and @BigDataExpo has been named fourteenth by Right Relevance (RR), which provides curated information and intelligence on approximately 50,000 topics. In addition, Right Relevance provides an Insights offering that combines the above Topics and Influencers information with real time conversations to provide actionable intelligence with visualizations to enable decision making. The Insights service is applicable to eve...
SYS-CON Events announced today that Hitachi Data Systems, a wholly owned subsidiary of Hitachi LTD., will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City. Hitachi Data Systems (HDS) will be featuring the Hitachi Content Platform (HCP) portfolio. This is the industry’s only offering that allows organizations to bring together object storage, file sync and share, cloud storage gateways, and sophisticated search an...
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm.
@GonzalezCarmen has been ranked the Number One Influencer and @ThingsExpo has been named the Number One Brand in the “M2M 2016: Top 100 Influencers and Brands” by Analytic. Onalytica analyzed tweets over the last 6 months mentioning the keywords M2M OR “Machine to Machine.” They then identified the top 100 most influential brands and individuals leading the discussion on Twitter.
SYS-CON Events announced today that T-Mobile will exhibit at SYS-CON's 20th International Cloud Expo®, which will take place on June 6-8, 2017, at the Javits Center in New York City, NY. As America's Un-carrier, T-Mobile US, Inc., is redefining the way consumers and businesses buy wireless services through leading product and service innovation. The Company's advanced nationwide 4G LTE network delivers outstanding wireless experiences to 67.4 million customers who are unwilling to compromise on ...
In his keynote at 19th Cloud Expo, Sheng Liang, co-founder and CEO of Rancher Labs, discussed the technological advances and new business opportunities created by the rapid adoption of containers. With the success of Amazon Web Services (AWS) and various open source technologies used to build private clouds, cloud computing has become an essential component of IT strategy. However, users continue to face challenges in implementing clouds, as older technologies evolve and newer ones like Docker c...
With major technology companies and startups seriously embracing Cloud strategies, now is the perfect time to attend @CloudExpo | @ThingsExpo, June 6-8, 2017, at the Javits Center in New York City, NY and October 31 - November 2, 2017, Santa Clara Convention Center, CA. Learn what is going on, contribute to the discussions, and ensure that your enterprise is on the right path to Digital Transformation.
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Data is an unusual currency; it is not restricted by the same transactional limitations as money or people. In fact, the more that you leverage your data across multiple business use cases, the more valuable it becomes to the organization. And the same can be said about the organization’s analytics. In his session at 19th Cloud Expo, Bill Schmarzo, CTO for the Big Data Practice at Dell EMC, introduced a methodology for capturing, enriching and sharing data (and analytics) across the organization...