0

我已经在 linux 上安装了 Timesten 数据库(完整版)(Linux 是通过带有 cloudera VM 的 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 文件夹位置

/home/cloudra/timesten/TimesTen/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_library_path 输出

[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 参数时它没有设置任何参数,所以我必须手动进行。

大师和专家..请在这里帮助我..不确定是什么问题以及为什么我收到上述错误。

谢谢你的帮助..

4

1 回答 1

1

这里的关键是:

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.solibtten.so<TimesTen_install_dir>/lib如果没有,那么这意味着您只安装了一个客户端,并且需要配置/使用客户端/服务器连接。

于 2018-07-10T12:53:17.090 回答