2

I tried to import TDengine into the Spring Boot project. There are two taos.jdbc connectors to choose from, RESTfulDriver and TSDBDriver.

I chose to import the Java native interface TSDBDriver to connect to TDengine. Unfortunately, Spring Boot successfully imported the dependencies but showed that the connection failed. I want to know if it is due to a configuration problem or TSDBDriver is not compatible with mac. Here are my dependencies and errors:

 datasource:
        td-engine:
          driver-class-name: com.taosdata.jdbc.TSDBDriver
          url: jdbc:TAOS://###
          username: ###
          password: ###
java.lang.UnsatisfiedLinkError: no taos in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
    at java.lang.Runtime.loadLibrary0(Runtime.java:871)
    at java.lang.System.loadLibrary(System.java:1124)
    at com.taosdata.jdbc.TSDBJNIConnector.<clinit>(TSDBJNIConnector.java:25)
    at com.taosdata.jdbc.TSDBDriver.connect(TSDBDriver.java:119)
    at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156)
    at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218)
    at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150)
    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1598)
    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1662)
    at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2697)
cpvmrd
  • 51
  • 4

1 Answers1

1

It means that you need to add libtaos.so to your java.library.path. Add this option to your java command:

-Djava.library.path=/path/to/<dir_of_libtaos.so>

If you installed TDEngine locally, it has libtaos.so in /usr/lib. Otherwise, you can find its libtaos.so.2.0.22.0 in its source codes packages. You need to make a symbol link libtaos.so to libtaos.so.2.0.22.0 since jvm only recognizes *.so in java.library.path. For example:

ln -s lib/libtaos.so.2.0.22.0 lib/libtaos.so
Lin
  • 41
  • 2