cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Display Data from MySQL

kevind1
1-Visitor

Display Data from MySQL

Hi there,


I would like to display data from the database.  Here is what I did, 


1. I created a template and connected to mysql.

2. I created a thing and was able to create a service in my thing and the data is showing. 

3. I go to the mashup and do a binding and I select the thing using GetProperties and the data is not returning. 


Is there any reason why it is not displaying anything from the database?


Thank you,

Kevin



6 REPLIES 6

Hi Kevin,

This is how i suggest you to do... I'm connecting using SQL Server, so you'll have to check what are the parameters for mysql


1- Create a Database thing. 

2- On the Configuration tab:

  2.A- DRIVER: com.microsoft.sqlserver.jdbc.SQLServerDriver

  2.B- Connection string: jdbc:sqlserver://localhost;databaseName=ThingWorx_Dev

  2.C- Connection validation string: SELECT GetDate()

  2.D Enter db user/pwd

3- On the service tab (inside the database thing created)

  3.A- Create a service (Service Type = QUERY) 

  After you have the service setup, TEST it and guarantee that the query is working. 

4- Create a Datashape which is the output of your query. 


Only after that, you'll use it on the Mashup. 


It took me sometime to learn, but the mashup is the last thing you will do. 


Good luck

Claudio



Those items I have created, but once I get to the Mashup, is there I'm having problems....


Not sure which service to use... Once I get it, I'll be able to bind the service and show the data.


Thank you,

Kevin



paic
12-Amethyst
(To:kevind1)

You can review the MySQL database interaction in eLearning, but like what Claudio wrote.

You have to create SQL Queries and Commands to interact with the database.
GetProperties will retrieve properties from the Database Thing itself, none of its actual content.
By going to Services and creating those services you create the actual interaction with the Database.
Those are the services you want to call up in the Mashup.

kevind1
1-Visitor
(To:paic)

That is what I did..


I pulled in the service and linked it to the info table on the mashup and yet data is not returning. I did check the query and it is working. 





paic
12-Amethyst
(To:kevind1)

If you click on your Service, is there any Event that is running the service, like Mashup Loaded for example?

kevind1
1-Visitor
(To:paic)

I found a solution. What I forgot to do is this, I did create the datashape, however in the service, I forgot to add the datashape in the service. I added it and now it i working... 

Announcements


Top Tags