Skip to Content
Author's profile photo Mahesh Gadgil

ODATA services in ASE

A co-worker who sits across from me recently asked me some questions about ODATA producer in ‘SAP/Sybase Adapter Server Enterprise’  that I have been working on for more than a year now. His were the exact questions any person interested in using it would ask. So, it made sense to document the conversation here in the actual format ( Q & A )  it occurred.   I hope it provides enough information for someone who may want to give it a try. I am looking forward in sharing more details with the community if there is any interest.

Q –  I know you have been working on this ODATA producer and I am wondering if that could help in the project I am working on. We are in the process of designing a gui application that requires to pull information from ASE and since our company has standardized on the odata as an interface between applications, I am curious as to how we can make use of it. So please tell me what this odata producer is and how easy it is to run it.

A – ODATA producer is a web application that confirms to ODATA specification. It comes prepackaged with standard ASE install.

Q – How easy it is to run this producer.

A – It’s really easy. You just need to run batch/shell script that’s included with the install to run the application. The application itself is a java web application that runs on Jetty webserver(included).

Q – What port does this webserver run on?

A – You can configure the port for the webserver. You can also configure the port number on which the server will listen for a shutdown command.

Q – How do you configure the ports

A – The sample applications included with the standard install provides an example of a configuration file. Another important configuration parameter is the connection url to the underlying database. Requests for information from the web client are serviced by the webserver by retrieving information from the underlying database.

Q – What sort of information can I get from the service.

A – You can decide what information (db tables) you want to expose to the users. With the anonymous service all the tables that have primary keys will be exposed to the user. User authentication is controlled through a parameter in the configuration file. In the most simple challenge/response scenario of authentication, user supplied credentials are verified against the underlying database and only that information to which user has access to is shown to the user.

Q – I was wondering if we could use odata to get data from tables where data is constantly changing, the tables like system monitoring tables.

A – Constantly changing data is not a problem. Being a web application, the odata producer implements request/response architecture. User always sees the data in the state it was in when the request was made. Since ODATA producer is based on REST architecture, each row of the table needs to be uniquely identified. Hence only those tables that have a unique id defined on them are exposed to the user. To expose tables that do not have a unique id, you can create a configuration file where you define the table name and the column name that should be used as a primary key.

Q – In what format the data is available.

A – ASE producer supports JSON and Atom/XML formats for the data. ODATA specifies the formats for the client requests. For example, if ASE producer is running on localhost:8080 then navigating to http://localhost:8080/odata/$metadata will produce metadata. The metadata includes data about all tables with their names, column names, column names of the primary key, their foreign key relationships with other tables, data types and width of each column etc. http://localhost:8080/odata/t1 will show all the rows from t1 table. Each row is assigned a url for direct access following REST principle that requires each data item be accessible as a web resource.

Q – The application seems like something that I could use in my project, can I get help?

A – The producer comes with sample client application and bunch of setup files. The setup files create sample database through sql and provides some default configuration for your application. The sample is a web application coded in java and dot net language. If you follow the readme.txt from the samples folder you should be able to run sample application in a few minutes.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.