Using a published database service

jacktyrrell
jacktyrrell's picture
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 05/27/2009
Points: 130

Hi all,

I am currently trying to link a datasource ( MySQL database)so that i can use the output from the database as an input in Presto wires, is this possible?

I have successfully tested the MySQL database in "manage data sources" and have published the database service (a copy of this is available in the attachment) but when i try to use it in a simple wires mashup, i am getting the following error when trying to preview results

"Failed to execute the Service : Could not initialize class com.jackbe.jbp.jems.moe.runtime.commands.InvokeCommand"

would this be because the service does not provide an output (see attachement) and if so what settings need to be changed to do this

 

thanks

Jack

0
Your rating: None
aishmishra
aishmishra's picture
User offline. Last seen 10 weeks 6 days ago. Offline
Joined: 09/24/2008
Points: 3

Hi Jack,

You surely can create a mashup using a database source and the way you have gone about it is just about the way it should be. To summarize it, just to be sure.

i. Configure driver and test

ii. Configure database source and test

iii. Create database service

iv. Are you running mysql on your local machine.

Also, which platform are you running mashup server on?

jacktyrrell
jacktyrrell's picture
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 05/27/2009
Points: 130

Yea that is the way i went about it.

I am running mysql on my local machnine and the mashup server is running on Windows XP

Hope this helps

Jack

smitchell
smitchell's picture
User offline. Last seen 16 hours 58 min ago. Offline
Joined: 08/29/2008
Points: 34

Is the operation you are trying to invoke a stored procedure?

Please also check two things: 

1) from Wires, view the EMML (from More actions toolbar). Copy the EMML code into a file and attach it here.

2) You should have a block for the DB service in your mashup. Click Preview (green arrow at the bottom of the block) and change the view to JSON. This should show the response (if any) in raw JSON format. Let us know what, if anything shows up.

Sara, technical writer/jackbe

 

jacktyrrell
jacktyrrell's picture
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 05/27/2009
Points: 130

Hi,

Tried it today and is somehow is working fine, i was using just the standard functions it provide like findby.

The output from this is in XML format do you no of any way to change this to grid as i want to be able to select a row and input automatically be taken from fields into separate mashlets

thanks

smitchell
smitchell's picture
User offline. Last seen 16 hours 58 min ago. Offline
Joined: 08/29/2008
Points: 34

Mashups return XML by default. But there is no UI associate with a mashup.

To 'put it in a grid', you either have these options: 

* Create your own UI and use Presto Connect to invoke the mashup and get the data back (in which case it comes back in JSON format by default).

* Create a basic mashlet based on this mashup and choose the grid view. This is the easiest way. Just save your mashup, publish it and choose (in Wires) to create a mashlet (goes to Mashlet Maker). You can get the grid -- but it is not customizable, at least in terms of addding code to detect a select event and then respond.

* Create a custom mashlet that gives you your own UI but takes advantage of the simple ways to embed it in web pages, portals, iGoogle, etc. It also gives you the synchronization capabilities of sending event information to other mashlets which is what you are talking about. You have to create the UI (the grid) with this option. Look in documentation for custom mashlets -- and then look at the sample mashlets in folders under {web-app-home}/mashlets where the Mashup Server is deployed. These should give you some ideas.

 

Sara, technical writer/jackbe

 

jacktyrrell
jacktyrrell's picture
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 05/27/2009
Points: 130

thanks very much for the ideas, i think i will give invoking the mashup and then manipulating the JSON a go, cheers

glenn.adams
User offline. Last seen 45 weeks 5 days ago. Offline
Joined: 05/18/2010
Points: 80

 Sorry to resurrect an old thread, but I am seeing the same error message on a Database Service.  Hopefully I will get the "magically works tomorrow" behavior but just in case I wanted to get my question out there.

I am trying to connect to MS SQL Server 2005.  The SQL Server is not running locally, but on a different server on my LAN.  Presto Developer Edition IS running locally on my workstation.  I have installed the MS SQL Server JDBC Driver (Version 3) and have done essentially the steps outlined in this thread:

Create a SQL Server Driver entry

Create a data source (test Data Source is successful)

Create a DB Service using my new DataSource (successfully queries objects and creates Operations)

In Wires, Expand the DB Service and drag one of the default operations (findCustomerAll) on the the Mashup window.  There are no parameters for this operation.

Click the preview arrow and I get the error mentioned above:

"Could not initialize class

com.jackbe.jbp.jems.moe.runtime.commands.InvokeCommand"

There is nothing to configure in the Data Preview, since the error occurs, but I have the EMML and am posting it below.

Any ideas on resolving this?  I rebooted after installing the JDBC driver, although I don't think that was really needed.

Thansk,
Glenn 

 

<mashup name="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jackbe.com/2008-03-01/EMMLSchema../src/schemas/EMMLSpec.xsd" xmlns="http://www.jackbe.com/2008-03-01/EMMLSchema" xmlns:macro="http://www.jackbe.com/2008-03-01/EMMLMacro" >
<operation name="runMashup" >
<variable name="limitRecords" type="number" default="-2"/>

<output wires_id="output_0" name="output_0" type="document" service="TestSQL"/>
<invoke wires_id="invoke_4" name="invoke_4" header="" service="TestSQL" operation="findCustomerAll" serviceVersion="" outputvariable="output_0" onerror="continue" inputvariables="" />

</operation>
</mashup>