有谁知道vertica的odbc连接字符串的格式吗?

发布于 2024-11-03 19:44:12 字数 953 浏览 1 评论 0原文

我正在使用以下内容:

DRIVER={Vertica ODBC Driver 4.1};
SERVER=lnxtabdb01.xxxx.com;
PORT=5433;
DATABASE=vertica;
USER=dbadmin;
PASSWORD=vertica;
OPTION=3;

我收到此错误,我只是想在检查其他可能的问题之前确保我的连接字符串很酷。

错误:

EnvironmentError: System.Data.Odbc.OdbcException (0x80131937): ERROR [28000] FATAL: no Vertica user name specified in startup packet

更新: 现在我只使用 Windows Vista 中可以使用的系统数据源名称。但我仍然想知道是否有 odbc 连接字符串,这样我就不必在每台以这种方式连接到 Vertica DB 的计算机上进行设置。

好吧,我尝试了一个如下所示的 postgresql 连接字符串:

Host=lnxtabdb01.xxxx.com;
Port=5433;
Database=vertica;
User ID=dbadmin;
Password=vertica;
Pooling=true;
OPTION=3;
Min Pool Size=0;
Max Pool Size=100;
Connection Lifetime=0;

现在我得到了这个:

EnvironmentError: System.Data.Odbc.OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I'm using the following:

DRIVER={Vertica ODBC Driver 4.1};
SERVER=lnxtabdb01.xxxx.com;
PORT=5433;
DATABASE=vertica;
USER=dbadmin;
PASSWORD=vertica;
OPTION=3;

i'm getting this error and I just wanted to make sure that my connection string was cool before I check other possible issues.

error:

EnvironmentError: System.Data.Odbc.OdbcException (0x80131937): ERROR [28000] FATAL: no Vertica user name specified in startup packet

UPDATE:
For now i'm just using a System Data Source Name in Windows Vista that I can use. But i'd still like to know if there's an odbc connection string so that i don't have to set that up on every machine that will be connecting to the Vertica DB in this fashion.

well, I tried a postgresql connection string that looks like this:

Host=lnxtabdb01.xxxx.com;
Port=5433;
Database=vertica;
User ID=dbadmin;
Password=vertica;
Pooling=true;
OPTION=3;
Min Pool Size=0;
Max Pool Size=100;
Connection Lifetime=0;

now i'm getting this:

EnvironmentError: System.Data.Odbc.OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

待天淡蓝洁白时 2024-11-10 19:44:12

接受的答案描述了一种使用系统DSN连接Vertica ODBC驱动程序的方法。可以仅使用连接字符串来直接配置针对驱动程序的连接。以下连接字符串模式已针对 Vertica ODBC 客户端驱动程序 v6.1.2 进行了测试:

Driver=Vertica;Server=MyVerticaServer;Port=5433;Database=MyVerticaDB;UID=foo;PWD=bar

端口是可选的:

Driver=Vertica;Server=MyVerticaServer;Database=MyVerticaDB;UID=foo;PWD=bar

或者,如果您像我一样在 .NET 中执行此操作,则可以使用它来格式化从必要的参数中获取连接字符串:

var connectionString = string.Format(
            "Driver=Vertica;Server={0};{1}Database={2};UID={3};PWD={4}",
            server,
            port == null ? string.Empty : string.Format("Port={0};", port),
            database,
            username,
            password);

The accepted answer describes a way to connect with the Vertica ODBC driver using a System DSN. It is possible to connect using just a connection string to directly configure the connection against the driver. The following connection string pattern has been tested against the Vertica ODBC Client Driver v6.1.2:

Driver=Vertica;Server=MyVerticaServer;Port=5433;Database=MyVerticaDB;UID=foo;PWD=bar

Port is optional:

Driver=Vertica;Server=MyVerticaServer;Database=MyVerticaDB;UID=foo;PWD=bar

Or, if you're doing this in .NET as I am, you can use this to format up the connection string from the necessary parameters:

var connectionString = string.Format(
            "Driver=Vertica;Server={0};{1}Database={2};UID={3};PWD={4}",
            server,
            port == null ? string.Empty : string.Format("Port={0};", port),
            database,
            username,
            password);
对岸观火 2024-11-10 19:44:12

我也没有看到任何在没有 DSN 的情况下使用 ODBC 的方法。这是我的 Linux 工作站的 DSN 设置。

[VerticaDSN]
Description = VerticaDSN ODBC driver
Driver = /opt/vertica/lib64//libverticaodbc_unixodbc.so
Database = Retail
Servername = localhost
UserName = vertica
Password =
Port = 5433

I too have not seen any way to use ODBC without a DSN. Here's my DSN settings for my linux workstation.

[VerticaDSN]
Description = VerticaDSN ODBC driver
Driver = /opt/vertica/lib64//libverticaodbc_unixodbc.so
Database = Retail
Servername = localhost
UserName = vertica
Password =
Port = 5433
姐不稀罕 2024-11-10 19:44:12

您可以使用包含以下内容的连接字符串连接到 Vertica ODBC 数据源,而无需配置/指定数据源名称 (DSN):

  • Windows:

    Driver=Vertica ODBC Driver 4.1;Servername=主机名;端口=5433;Database=vertica;UserName= >dbadmin;Password=sekret

  • Linux/Unix

    Driver=Vertica;Servername=主机名;端口=5433;Database=vertica;UserName=dbadmin< /em>;密码=sekret

将每个斜体 替换为适合您环境的值。 (注意:连接字符串中的name=valueseem区分大小写。)

You can connect to a Vertica ODBC data source without configuring/specifying a Data Source Name (DSN) using a connection string that includes the following:

  • Windows:

    Driver=Vertica ODBC Driver 4.1;Servername=hostname;Port=5433;Database=vertica;UserName=dbadmin;Password=sekret

  • Linux/Unix

    Driver=Vertica;Servername=hostname;Port=5433;Database=vertica;UserName=dbadmin;Password=sekret

Replace each italicized value with those appropriate to your environment. (Note: the name=value pairs in the connection string seem to be case-sensitive.)

扬花落满肩 2024-11-10 19:44:12

您是否看过http://www.connectionstrings.com/?它没有具体列出 Vertica DB,但有数十种其他数据库类型可能与 vertica 足够相似,它们可以很好地翻译......

Have you looked at http://www.connectionstrings.com/? It doesn't specifically have a Vertica DB listed but there dozens of other database types that might be similar enough to vertica that they will translate well....

眼眸印温柔 2024-11-10 19:44:12

当使用 ODBC 时,我总是使用 Windows 并设置 DSN。然而,我唯一的建议(这将是针对 Vertica 中许多不同类型问题的一般建议)是尝试 PostgreSQL 的 ODBC 格式。

大多数非底层的内容都基于 PostgreSQL,尤其是 SQL 语法和函数。所以我会去前面提到的 http://www.connectionstrings.com 并查找 PostgreSQL 是如何做到的。

When using ODBC I was always using Windows and setting up a DSN. However, my only suggestion, and this would be a general suggestion for many different types of problems in Vertica, would be to try the ODBC format for PostgreSQL.

Mostly everything that isn't under-the-hood is based on PostgreSQL, especially SQL syntax and functions. So I would go to the aforementioned http://www.connectionstrings.com and look up however PostgreSQL does it.

梦屿孤独相伴 2024-11-10 19:44:12

好的,我正在搜索 Vertica 文档,但没有看到任何在不创建 DSN 的情况下连接 ODBC 的方法。 JDBC 似乎是另一回事。如果有办法做到这一点,我不会看到它。

问题似乎是(假设您有驱动程序)系统不知道您的连接字符串应由 Vertica 驱动程序处理。 DSN 已经指定了这一点,所以这就是它起作用的原因(我有根据的猜测)。

这是他们为 JDBC 提供的示例:

“jdbc:vertica://server:port/db?user=username&password=password&ssl=true”

JDBC 连接字符串似乎让代码知道它应该使用 Vertica 。

让我发布有关 ODBC 的相关文档的一部分(请原谅格式):

DSN 参数

下表中的参数对于所有用户和系统 DSN 条目都是通用的。提供的示例适用于 Windows 客户端。

编辑 DSN 参数:

* UNIX and Linux users can edit the odbc.ini file. (See Creating an ODBC DSN for Linux and Solaris Clients.) The location of this file is specific to the driver manager.
* Windows users can edit the DSN parameters directly by opening the DSN entry in the Windows registry (for example, at HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\vmartdb). However, the Vertica-preferred method is to follow the steps in Creating an ODBC DSN for Windows Clients.
* Parameters can be set while making the connection using SQLDriverConnect().

  sqlRet = SQLDriverConnect(sql_hDBC, 0, (SQLCHAR*)"DSN=VerticaSQL;BinaryDataTransfer=1",

  SQL_NTS, szDNS, 1024,&nSize, SQL_DRIVER_NOPROMPT);



  Note: In the connection string ';' is a reserved symbol. If you need to set multiple parameters as part of ConnSettings parameter use '%3B' in place of ';'. Also use '+' instead of spaces.

  For Example:

  sqlRet = SQLDriverConnect(sql_hDBC, 0, (SQLCHAR*)"DSN=VerticaSQL;BinaryDataTransfer=1;ConnSettings=

  set+search_path+to+a,b,c%3 Bset+locale=ch;SSLMode=prefer", SQL_NTS,

  szDNS, 1024,&nSize, SQL_DRIVER_NOPROMPT);



* Parameters can also be set and retrieved after the connection has been made using SQLConnect(). Parameters can be set and retrieved using SQLSetConnectAttr(),SQLSetStmtAttr(), SQLGetConnectAttr() and SQLGetStmtAttr() API calls. 

Ok, I'm searching through the Vertica documentation and I'm not seeing any way of connecting with ODBC without creating a DSN. JDBC appears to be a different matter. If there is a way to do it, I'm not seeing it.

The problem appears to be (assuming you have the driver) that the system doesn't know that your connection string should be handled by the Vertica driver. A DSN has that specified already, so that's why that works (my educated guess).

This is the example they give for JDBC:

"jdbc:vertica://server:port/db?user=username&password=password&ssl=true"

The JDBC connection string seems to let the code know that it should be using Vertica.

Let me post part of the pertinent document (forgive the formatting) regarding ODBC:

DSN Parameters

The parameters in the following tables are common for all user and system DSN entries. The examples provided are for Windows clients.

To edit DSN parameters:

* UNIX and Linux users can edit the odbc.ini file. (See Creating an ODBC DSN for Linux and Solaris Clients.) The location of this file is specific to the driver manager.
* Windows users can edit the DSN parameters directly by opening the DSN entry in the Windows registry (for example, at HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\vmartdb). However, the Vertica-preferred method is to follow the steps in Creating an ODBC DSN for Windows Clients.
* Parameters can be set while making the connection using SQLDriverConnect().

  sqlRet = SQLDriverConnect(sql_hDBC, 0, (SQLCHAR*)"DSN=VerticaSQL;BinaryDataTransfer=1",

  SQL_NTS, szDNS, 1024,&nSize, SQL_DRIVER_NOPROMPT);



  Note: In the connection string ';' is a reserved symbol. If you need to set multiple parameters as part of ConnSettings parameter use '%3B' in place of ';'. Also use '+' instead of spaces.

  For Example:

  sqlRet = SQLDriverConnect(sql_hDBC, 0, (SQLCHAR*)"DSN=VerticaSQL;BinaryDataTransfer=1;ConnSettings=

  set+search_path+to+a,b,c%3 Bset+locale=ch;SSLMode=prefer", SQL_NTS,

  szDNS, 1024,&nSize, SQL_DRIVER_NOPROMPT);



* Parameters can also be set and retrieved after the connection has been made using SQLConnect(). Parameters can be set and retrieved using SQLSetConnectAttr(),SQLSetStmtAttr(), SQLGetConnectAttr() and SQLGetStmtAttr() API calls. 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文