2010-04-23 3 views
3

Моя компания использует Vertica. У нас есть приложения Python, которые подключаются к нему с помощью pyodbc. Я делаю большую часть своей разработки на Mac (Snow Leopard), и, к сожалению, Vertica не выпустила драйверы ODBC для Mac. Однако у них есть драйверы JDBC. Я не думаю, что разработка в Jython - хороший компромисс. Есть ли способ использовать драйверы JDBC с приложением ODBC? Какой-то разъем ODBC?Использование приложения ODBC с драйвером JDBC

ответ

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}; 
+0

Я просто собираюсь предположить, что это отвечает на вопрос. Я не могу это проверить, поскольку у меня не было необходимости в Vertica за долгое время. –

1

Да, есть мосты ODBC-over-JDBC. OpenLink, среди прочих, обеспечивает один для Mac OS.

+0

Я надеюсь, выпуск Leopard работает на Snow Leopard –

+0

Um, как я могу использовать эту вещь? –

+0

Я не пробовал. Однако продукт включает базовую поддержку (http://support.openlinksw.com/supportweb/SupportServicesFAQ#SupportContractNeeded). –

Смежные вопросы