The query and resource can be seen below: This call will return a result set with only one column “Role Name”. In this query, we are executing an existing stored procedure in Sybase, in this case sp_activeroles, to call it we use the exec: exec sp_activeroles With that in place, we can call for example, the /products resources like below: We will have a return like below: Įxecuting a Stored Procedure with no parameters We define a SOAP operation QueryAllProducts and a Rest Resource /products both of them pointing to the same query. Select ID,name ,description, price from īasically, we define a query against the product table, and we map the columns returned in the query to the expected attributes in the response. We can see the query, operation(SOAP) and resource(REST) for that: This is very similar to any select query in other RDBMS, we can see the details below: A Stored procedure call with parameters.A Stored procedure call with no parameters.In the Dataservice above we have 3 operations exposed: The full code of the example we will create can be seen below: If everything is set up correct when we click on Test Connection, it should be successful, after that, we can click on Save. URL: jdbc:sybase:Tds:localhost:5000/testdb.Go into Configure tab -> Datasources, and then click Add Datasource: In this example, we will create the datasource using the Carbon Console UI, but you can find other ways to create it here. Now that we have the jar file copied into the EI installation and restarted it, we can create a new Datasource pointing to the Sybase server. After that we need to restart the EI Server in order to load the jar file. Once we have the jar file, we need to copy it into /lib folder. We need to replace the with the id retrieved in the docker ps command output. The above command will copy the jconn4.jar from that location into the current folder in the local machine. So, to copy the jdbc driver jar from the container to our local machine we can use the following command: docker cp :/opt/sybase/shared/lib/jconn4.jar. To obtain the container id we can use the docker ps command, below we can see the output: CONTAINER ID IMAGE. In order to do that, we can use the command docker cp, but we need to have the container id. I could not find a link to download it, (my fault, I was lazy to look for it), but, we have it available inside the Sybase container that we started in the previous steps. We can use the JTDS Driver or the JConnect Driver, for our example, we will use the JConnect Driver. Connecting WSO2 EI to the Sybase Database The command above will create the table in the testdb schema. We will create a products table like below: CREATE TABLE ( In Dbeaver the connection details will look like below:Īfter connected, we can see the list of the database schemas available:įor our example, we will use the testdb schema. In our example we will connect with admin user(sa). We can use a SQL Client to connect to it, one good client is DBeaver. The default credentials can be found in the docker image page in dockerhub. This Docker image contains a Sybase 16.2, to start it we just need to run the following command: docker run -d -t -p 5000:5000 datagrip/sybaseĪfter sometime, ~30s, we can connect to the sybase instance. For that, we will use the following Docker Image available in Dockerhub: datagrip/sybase. In order to have this example to work, we need to have an instance of Sybase. For this post, we have used WSO2 EI 6.5.0, but it should work with EI 7 as well. This post will show a quick example on how we can connect with Sybase database using WSO2 EI DataServices.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |