-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[功能建议] jni动态库支持调用方用System.load()方法自己加载 #69
Comments
对的,麻烦的要死。。。。。为什么不采用标准的 JNA 接口来加载,总是为难开发人员,维护升级也是要命。。 |
在mac使用jdbc,无法使用 建议优化下代码 |
官方一直不管,我现在都是改源码,把上述的 static {
System.loadLibrary("taos");
} 去掉重新打个fix包自己用 |
欢迎 PR |
请问是否有Java的contribute规范 |
建议驱动包自带各个已支持的平台和架构的JNI本地库文件,参考各个流行工具的多平台支持方案,根据平台自动加载相应的库,做到开箱即用,同时添加自定义加载路径支持,解决特殊平台的自定义本地库加载,现在想使用本地连接方式太麻烦了。 |
现状
目前
com.taosdata.jdbc.TSDBJNIConnector
类强制使用System.loadLibrary
方法类加载jni动态库,代码如下:问题
无法将jni动态库文件放入jar包内或其他配置目录来自由加载动态库,部署时必须要将动态库放到
java.library.path
内 或 将jni动态库文件所在目录指定到java.library.path
,封装不够彻底,运维较麻烦原因
java.library.path
内的动态库只在jvm启动时加载,项目启动后无法加载(jdk11前可以用反射方式强制jdk重新加载至少在jdk17后不行)。建议
在执行
System.loadLibrary
做一下判断,如果识别动态库已经载入jvm就不执行System.loadLibrary
方法,封装者就能在使用TSDBJNIConnector
前自己使用System.load
方法加载动态库文件The text was updated successfully, but these errors were encountered: