无法在linux上通过jdbc将sqoop连接到oracle timesten

1tu0hz3e  于 2021-06-03  发布在  Sqoop
关注(0)|答案(1)|浏览(404)

我已经在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\u 64/bin/home/cloudera/timesten/timesten/tt1122\u 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参数时它没有设置任何参数,所以我必须手动执行。
大师和Maven。。请帮帮我。。不知道是什么问题,为什么我得到上述错误。
谢谢你的帮助。。

nmpmafwu

nmpmafwu1#

关键是:

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

timestenjdbc驱动程序是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 如果没有,那么这意味着您只安装了一个客户机,而需要配置/使用客户机/服务器连接。

相关问题