使用ODBC应用程序与JDBC驱动程序

3

我的公司使用Vertica。我们有连接到它的Python应用程序,并使用pyodbc。可惜的是,Vertica没有为Mac发布ODBC驱动程序,而我们大部分开发工作都是在Mac(Snow Leopard)上进行的。不过,他们有JDBC驱动程序。我认为在Jython中开发并不是一个很好的折衷办法。是否有任何方法可以将JDBC驱动程序与ODBC应用程序一起使用?有什么样的ODBC连接器吗?

3个回答

4

更新:vertica 5/6的更新可以在这里找到:https://github.com/serbaut/psycopg2

这里提供一个补丁,使得psycopg2 2.2.1可以与vertica 4.0兼容。无需使用ODBC。

diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index 902fdbb..b07eee8 100644
--- a/psycopg/connection_int.c
+++ b/psycopg/connection_int.c
@@ -280,6 +280,10 @@ conn_setup(connectionObject *self, PGconn *pgconn)
         pgres = psyco_exec_green(self, psyco_datestyle);
     }

+    if (self->server_version == 0 && self->protocol == 3) { /* vertica */
+      self->encoding = strdup("UTF8");
+      self->isolation_level = 0;
+    } else {
     if (pgres == NULL || PQresultStatus(pgres) != PGRES_COMMAND_OK ) {
         PyErr_SetString(OperationalError, "can't set datestyle to ISO");
         IFCLEARPGRES(pgres);
@@ -335,7 +339,7 @@ conn_setup(connectionObject *self, PGconn *pgconn)
         return -1;
     }
     self->isolation_level = conn_get_isolation_level(pgres);
-
+    }
     Py_UNBLOCK_THREADS;
     pthread_mutex_unlock(&self->lock);
     Py_END_ALLOW_THREADS;
diff --git a/psycopg/typecast_builtins.c b/psycopg/typecast_builtins.c
index e8e5a1a..45b9dbc 100644
--- a/psycopg/typecast_builtins.c
+++ b/psycopg/typecast_builtins.c
@@ -1,15 +1,15 @@
 static long int typecast_NUMBER_types[] = {20, 23, 21, 701, 700, 1700, 0};
-static long int typecast_LONGINTEGER_types[] = {20, 0};
+static long int typecast_LONGINTEGER_types[] = {6, 20, 0};
 static long int typecast_INTEGER_types[] = {23, 21, 0};
-static long int typecast_FLOAT_types[] = {701, 700, 0};
-static long int typecast_DECIMAL_types[] = {1700, 0};
-static long int typecast_UNICODE_types[] = {19, 18, 25, 1042, 1043, 0};
+static long int typecast_FLOAT_types[] = {7, 701, 700, 0};
+static long int typecast_DECIMAL_types[] = {16, 1700, 0};
+static long int typecast_UNICODE_types[] = {8, 9, 19, 18, 25, 1042, 1043, 0};
 static long int typecast_STRING_types[] = {19, 18, 25, 1042, 1043, 0};
-static long int typecast_BOOLEAN_types[] = {16, 0};
-static long int typecast_DATETIME_types[] = {1114, 1184, 704, 1186, 0};
-static long int typecast_TIME_types[] = {1083, 1266, 0};
-static long int typecast_DATE_types[] = {1082, 0};
-static long int typecast_INTERVAL_types[] = {704, 1186, 0};
+static long int typecast_BOOLEAN_types[] = {5, 0};
+static long int typecast_DATETIME_types[] = {12, 13, 1114, 1184, 704, 1186, 0};
+static long int typecast_TIME_types[] = {11, 15, 1083, 1266, 0};
+static long int typecast_DATE_types[] = {10, 1082, 0};
+static long int typecast_INTERVAL_types[] = {14, 704, 1186, 0};
 static long int typecast_BINARY_types[] = {17, 0};
 static long int typecast_ROWID_types[] = {26, 0};
 static long int typecast_LONGINTEGERARRAY_types[] = {1016, 0};

我只是假设这回答了问题。但我无法验证它,因为我很久没有使用Vertica了。 - Nick Retallack

1

是的,有ODBC-over-JDBC桥接器。OpenLink等公司为Mac OS提供了其中之一。


我还没有尝试过。然而,该产品包括基本支持 (http://support.openlinksw.com/supportweb/SupportServicesFAQ#SupportContractNeeded)。 - Matthew Flaschen
你的意思是说我必须在他们解释如何工作之前购买它吗?这个网站非常商业化。我看不到任何开发者文档。 - Nick Retallack
哦,我找到了。http://wikis.openlinksw.com/dataspace/owiki/wiki/UdaWikiWeb/InstallODBCJDBCLiteOSX - Nick Retallack

0

从Vertica 6开始,可以从https://my.vertica.com门户网站下载适用于Mac OS X的本地ODBC驱动程序。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接