Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
New to Thingworx! I have a MS SQL Connection Thing. What is the easiest way to test this connection? How do I test a query on it?
David,
First of all, you need to download the Relational Databases Connector from Thingworx Marketplace where you will have access to a user guide tho. Once you have downloaded the connector, you need to import it into your Thingworx platform. After that, you will be able to create things impmlementing the Data Base Thing Template, configure the IP, Port, user and password of your MS SQL DB and finally generating services in order to run any type of queries.
If you need further or more specific help, let me know and I can help you.
The Relational Databases Connectors Extension for the ThingWorx Platform provides thing templates to enable you to connect to the most popular relational database servers. Using these templates in ThingWorx Composer, you can create connector things that configure a connection to a supported relational database server. To interact with the database server, you can write services for these things, using Javascript, or SQL queries and commands.
Following databases can easily connected by this extenstion.
Oracle Database – versions: 11, 12
MySQL – versions: 4.1, 5.0, 5.1, 5.5, 5.6, 5.7
Microsoft SQL – versions: 2008, 2012, 2014
PostgreSQL – versions: 7.2 and newer
IBM DB2 – versions: 10.1, 10.5
Sincerely
Ravi Upadhyay
Hi @David Bryant,
You can simply creating a test table in MySql DB and add a row.
Then create a service to read it from ThingWorx.
This would confirm its working fine.
Easier way would be to just check IsConnected property is true. This confirms that the Connection has been made with the DB.
But I prefer the first method to be sure.
I hope it helps.
Thanks,
Ankit Gupta
Hi Ankit , I've got a MSSQL DB thing which has isConnected true and lastConnection as current time. But when i run a service with select from temp table i have the following error,
Unable to Invoke Service Test on Database_Akzo : No suitable driver found for jdbc:sqlserver://<server name>;DatabaseName=<dbname>
I followed the link - Using a third party Jar file for Database connection but still the same error for manually created extension. Imported a Relational Database extension from marketplace for MSSQL but still the same issue. My tomcat lib has the MSSQL Jar file . Any ideas ?
Please check <Tomcat_Home>\webapps\Thingworx\WEB-INF\extensions and ThingworxStorage\extensions\MSSQL_ExtensionPackage\lib\common\ to confirm that jdbc.jar from the MSSQL extension is there.
Good catch ! The Web-INF extension had a old version of sql jar file ! Able to query the data now. Thanks for the help !
I am glad it helped.
It indicates that you had tried to update the extension to a new version and Tomcat restart was not performed.
Alternatively; a tomcat restart would have resolved this issue.