我已经在linux上安装了Timesten数据库(完整版本)(linux是通过带有cloudera虚拟机的Oracle虚拟机安装的来宾操作系统)
我正试图在linux上运行以下sqoop命令并获得以下错误
命令

sqoop list-tables --connect jdbc:timesten:direct:dsn=sampledb_1122 --driver com.timesten.jdbc.TimesTenDriver


**error**

ERROR manager.SqlManager: Error reading database metadata: java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbc in java.library.path
java.sql.SQLException: Problems with loading native library/missing methods: no ttJdbc in java.library.path
    at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1809)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:305)
    at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:161)
    at java.sql.DriverManager.getConnection(DriverManager.java:571)
    at java.sql.DriverManager.getConnection(DriverManager.java:233)
    at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:878)
    at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
    at org.apache.sqoop.manager.SqlManager.listTables(SqlManager.java:520)
    at org.apache.sqoop.tool.ListTablesTool.run(ListTablesTool.java:49)
    at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:227)
    at org.apache.sqoop.Sqoop.main(Sqoop.java:236)
Could not retrieve tables list from server
18/02/18 18:56:04 ERROR tool.ListTablesTool: manager.listTables() returned null

TimesTen bin和lib文件夹位置
/首页/云/时间十/时间十/tt1122_64/bin
/home/cloudera/timesten/timesten/tt1122_64/lib
在我的环境和其他参数中设置以下值
USERNAME=cloudera
DESKTOP_SESSION=gnome
MAIL=/var/spool/mail/cloudera
PATH=/var/lib/sqoop:/home/cloudera/timesten/TimesTen/tt1122_64/bin:/home/cloudera/timesten/TimesTen/tt1122_64/lib:/home/cloudera/anaconda3/bin:/var/lib/sqoop:/home/cloudra/timesten/TimesTen/tt1122_64/bin:/home/cloudera/timesten/TimesTen/tt1122_64/lib:/home/cloudera/anaconda3/bin:/home/cloudera/anaconda3/bin:/usr/local/firefox:/sbin:/usr/java/jdk1.7.0_67-cloudera/bin:/usr/local/apache-ant/apache-ant-1.9.2/bin:/usr/local/apache-maven/apache-maven-3.0.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/cloudera/bin
PWD=/home/cloudera
THREAD_FLAGS=native
HOME=/home/cloudera
SHLVL=2
M2_HOME=/usr/local/apache-maven/apache-maven-3.0.4
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=cloudera
CVS_RSH=ssh
CLASSPATH=/home/cloudera/timesten/TimesTen/tt1122_64/lib/ttjdbc6.jar

[cloudera@quickstart ~]$ echo $LD_LIBRARY_PATH
/home/cloudera/timesten/TimesTen/tt1122_64/lib:/home/cloudera/timesten/TimesTen/tt1122_64/lib:

[cloudera@quickstart ~]$ java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
[cloudera@quickstart ~]$

cloudera@quickstart bin]$ ./ttversion
TimesTen Release 11.2.2.8.0 (64 bit Linux/x86_64) (tt1122_64:53396) 2015-01-20T08:36:31Z
  Instance admin: cloudera
  Instance home directory: /home/cloudera/timesten/TimesTen/tt1122_64
  World accessible
  Daemon home directory: /home/cloudera/timesten/TimesTen/tt1122_64/info
  PL/SQL enabled.

除此之外。。ttjdbc6.jar文件位于以下位置
[cloudera@quickstart sqoop]$ pwd
/var/lib/sqoop
[cloudera@quickstart sqoop]$ ls -ltr
total 0
lrwxrwxrwx 1 root root 40 Jun  9  2015 mysql-connector-java.jar -> /usr/share/java/mysql-connector-java.jar
lrwxrwxrwx 1 root root 58 Feb 16 21:37 ttjdbc6.jar -> /home/cloudera/timesten/TimesTen/tt1122_64/lib/ttjdbc6.jar

[cloudera@quickstart timesten]$ pwd
/usr/lib/timesten
[cloudera@quickstart timesten]$ ls -ltr
total 276
-rwxrwxrwx 1 root root 279580 Feb 18 11:33 ttjdbc6.jar

Java库路径输出
[cloudera@quickstart timesten]$ java -XshowSettings:properties
Property settings:
    awt.toolkit = sun.awt.X11.XToolkit
    file.encoding = UTF-8
    file.encoding.pkg = sun.io
    file.separator = /
    java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
    java.awt.printerjob = sun.print.PSPrinterJob
    java.class.path = /home/cloudera/timesten/TimesTen/tt1122_64/lib/ttjdbc6.jar
    java.class.version = 51.0
    java.endorsed.dirs = /usr/java/jdk1.7.0_67-cloudera/jre/lib/endorsed
    java.ext.dirs = /usr/java/jdk1.7.0_67-cloudera/jre/lib/ext
        /usr/java/packages/lib/ext
    java.home = /usr/java/jdk1.7.0_67-cloudera/jre
    java.io.tmpdir = /tmp
    java.library.path = /home/cloudera/timesten/TimesTen/tt1122_64/lib
        /home/cloudera/timesten/TimesTen/tt1122_64/lib

        /usr/java/packages/lib/amd64
        /usr/lib64
        /lib64
        /lib
        /usr/lib
    java.runtime.name = Java(TM) SE Runtime Environment
    java.runtime.version = 1.7.0_67-b01

我执行ttenv.sh脚本,但在检查env参数时它没有设置任何参数,因此我不得不手动执行。
大师和专家。。请帮帮我。。不知道是什么问题,为什么我得到上述错误。
谢谢你的帮助。。

最佳答案

关键是:

java.sql.SQLException: Problems with loading native library/missing methods:
  no ttJdbc in java.library.path

TimesTen JDBC驱动程序是1/2类型的驱动程序,它依赖于底层的TimesTen本机库。具体来说,它需要几个位于<TimesTen_install_dir>/lib中的共享库,例如libttJdbc.so(错误所抱怨的库)、libtten.so等。通常,您需要确保java.library.path包含此目录(它看起来就是这样),并且CLASSPATH包含该目录中的ttjdbc7.jar文件。另一种可能是TimesTen安装是“仅客户端”安装,在这种情况下,您不能使用“直接”驱动程序,如果您尝试这样做,则会得到这个确切的错误。我建议检查一下您是否实际拥有libttJdbc.so中的文件libtten.so<TimesTen_install_dir>/lib,如果没有,则意味着您只安装了一个客户端,需要配置/使用客户端/服务器连接。

关于linux - 无法在Linux上通过JDBC将Sqoop连接到Oracle TimesTen,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48859268/

10-15 01:19