Skip to main content
1-Visitor
May 31, 2022
Solved

Problems connecting ThingWorx 9.2 to a external SQL server without using an external extension.

  • May 31, 2022
  • 2 replies
  • 2772 views

I followed this article to configure my database thing: https://www.ptc.com/en/support/article/cs318728

 

I got the database configured but when i try to run services to check the connection (the query that i'm trying is SELECT GetDate()) the following error returns: "Unable to Invoke Service RunDatabaseQuery on DatabaseConnection : Execute Query failed: java.sql.SQLException: Cannot get a connection, pool error Timeout waiting for idle object"

 

Don't know what may be wrong I used the following configuration for the database thing

Captura.PNG

And the property tab looks like this

Captura.PNG

Please let me know if you need more information to help me

Best answer by DmitryTsarev

@GerardAlonso , I have a few clarifying notes / suggestions...

 

1) Just to double-check... Since you're using jTDS driver for MS SQL, are you using a compatible SQL version? AFAIK, it only supports up to SQL Server 2012

 

2) To narrow down the cause, I'd suggest to take Microsoft's JDBC driver (7.4 for ThingWorx 9.0+) and check if it works with it.

I've just tested with sqljdbc_7.4.1.0 and attached the config tab of my database thing.

If it works, the issue is probably related to jTDS driver.

If it still doesn't work, something is probably wrong with your database Thing configuration or network.

 

Below is my full JDBC Connection String since it's not seen on the screenshot.

jdbc:sqlserver://192.168.1.17:1433;databaseName=twtest;applicationName=Thingworx;

 

TWSQL.PNG

2 replies

Community Manager
May 31, 2022

Hi @GerardAlonso 

 

I noticed you entered net.sourceforge.jtds.jdbc.Driver for the JDBC Driver Class Name.  Which jdbc driver did you install? 

 

Regards.

 

--Sharon

1-Visitor
June 1, 2022

Hi @slangley 

 

I followed this guide to configure the databse thing:

https://developer.thingworx.com/en/resources/guides/external-databases/external-database-connection

 

The configuration mentioned in this article  https://www.ptc.com/en/support/article/cs318728 was not working for me

 

Regards,

 

Gerard

17-Peridot
June 1, 2022

@GerardAlonso , I have a few clarifying notes / suggestions...

 

1) Just to double-check... Since you're using jTDS driver for MS SQL, are you using a compatible SQL version? AFAIK, it only supports up to SQL Server 2012

 

2) To narrow down the cause, I'd suggest to take Microsoft's JDBC driver (7.4 for ThingWorx 9.0+) and check if it works with it.

I've just tested with sqljdbc_7.4.1.0 and attached the config tab of my database thing.

If it works, the issue is probably related to jTDS driver.

If it still doesn't work, something is probably wrong with your database Thing configuration or network.

 

Below is my full JDBC Connection String since it's not seen on the screenshot.

jdbc:sqlserver://192.168.1.17:1433;databaseName=twtest;applicationName=Thingworx;

 

TWSQL.PNG

1-Visitor
June 1, 2022

Hi @DmitryTsarev 

 

Thank you very much for you suggestion and clariffications, I used the JDBC driver that you mention and now the database thing is working correctly.

 

Thanks,

 

Gerard