1

我在我的unix机器上设置了Timesten 客户端(11.2.2.8.0) 。

我在不同的机器上设置了 Timesten 服务器。

设置完成后,我尝试使用JDBC从我用 java 编写的 spark 代码连接到 Timesten 数据库。

我得到以下异常:

Exception in thread "main" java.sql.SQLException: [TimesTen][TimesTen 11.2.2.8.0 CLIENT]Cannot find the requested DSN (ormb_ttdb) in ODBCINI /var/TimesTen/tt1122/sys.odbc.ini or  /var/TimesTen/sys.odbc.ini
        at com.timesten.jdbc.JdbcOdbc.createSQLException(JdbcOdbc.java:3237)
        at com.timesten.jdbc.JdbcOdbc.standardError(JdbcOdbc.java:3386)
        at com.timesten.jdbc.JdbcOdbc.standardError(JdbcOdbc.java:3351)
        at com.timesten.jdbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:800)
        at com.timesten.jdbc.JdbcOdbcConnection.connect(JdbcOdbcConnection.java:1866)
        at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:305)
        at com.timesten.jdbc.TimesTenDriver.connect(TimesTenDriver.java:161)
        at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$createConnectionFactory$1.apply(JdbcUtils.scala:63)
        at org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils$$anonfun$createConnectionFactory$1.apply(JdbcUtils.scala:54)
        at org.apache.spark.sql.execution.datasources.jdbc.JdbcRelationProvider.createRelation(JdbcRelationProvider.scala:63)
        at org.apache.spark.sql.execution.datasources.SaveIntoDataSourceCommand.run(SaveIntoDataSourceCommand.scala:46)
        at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:70)
        at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:68)
        at org.apache.spark.sql.execution.command.ExecutedCommandExec.doExecute(commands.scala:86)
        at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:131)
        at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:127)
        at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:155)
        at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151)
        at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:152)
        at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:127)
        at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:80)
        at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:80)
        at org.apache.spark.sql.DataFrameWriter$$anonfun$runCommand$1.apply(DataFrameWriter.scala:654)
        at org.apache.spark.sql.DataFrameWriter$$anonfun$runCommand$1.apply(DataFrameWriter.scala:654)
        at org.apache.spark.sql.execution.SQLExecution$.withNewExecutionId(SQLExecution.scala:77)
        at org.apache.spark.sql.DataFrameWriter.runCommand(DataFrameWriter.scala:654)
        at org.apache.spark.sql.DataFrameWriter.saveToV1Source(DataFrameWriter.scala:273)
        at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:267)
        at com.sample.Transformation.main(Transformation.java:194)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.spark.deploy.JavaMainApplication.start(SparkApplication.scala:52)
        at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:879)
        at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:197)
        at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:227)
        at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:136)
        at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)

我在文件 at和位置设置了正确的TTC_SERVERTTC_SERVER_DSN值。sys.odbc.ini/var/TimesTen/var/TimesTen/tt1122

有人可以解释原因吗?

编辑

系统.odbc.ini

# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 

########################################################################
# This following sample definitions should be in the .odbc.ini file
# that is used for the TimesTen 11.2.2 Client.
# The Server Name is set in the TTC_SERVER attribute.
# The Server DSN is set in the TTC_SERVER_DSN attribute.
#########################################################################

[ODBC Data Sources]
#sampledbCS_1122=TimesTen 11.2.2 Client Driver
#cachedb1CS_1122=TimesTen 11.2.2 Client Driver
#repdb1CS_1122=TimesTen 11.2.2 Client Driver
#repdb2CS_1122=TimesTen 11.2.2 Client Driver

#[sampledbCS_1122]
TTC_SERVER=<SERVER's HOSTTNAME>
TTC_SERVER_DSN=ormb_ttdb

#[cachedb1CS_1122]
#TTC_SERVER=SERVER's HOSTTNAME
#TTC_SERVER_DSN=cachedb1_1122

#[repdb1CS_1122]
#TTC_SERVER=SERVER's HOSTTNAME
#TTC_SERVER_DSN=repdb1_1122

#[repdb2CS_1122]
#TTC_SERVER=SERVER's HOSTTNAME
#TTC_SERVER_DSN=repdb2_1122

我在火花代码中的连接字符串:

String ttConnection = "jdbc:timesten:client:dsn=<DSN_NAME>;UID=<USER_NAME>;PWD=<PASSWORD>";
4

0 回答 0