Does anyone know what are the parameters for creating a connection string to Vertica database using adodbapi? I cannot use pyodbc, because it does not work with IronPython.

I have tried:

    connectorsver = ["DRIVER=Vertica ODBC Driver 4.1"]
    connectorsver.append("SERVER=1.1.1.1\xx")
    connectorsver.append ("DATABASE=mydatabase")
    connectorsver.append ("User Id=dbadmin")
    connectorsver.append ("Password=xxx")
            con = adodbapi.connect(";".join (connectorsver)) 

and that returned an operational error. The same technique with an MSSQL connection string worked fine. When I created a DSN in Windows with this information, it also made a successful connection to vertica.

Any help is appreciated.

有帮助吗?

解决方案

Looking at the Unit Tests for ADODBAPO, connect() will raise an adodbapi.DatabaseError on failure. You should check for this exception:

try:
    con = adodbapi.connect(";".join (connectorsver))
except adodbapi.DatabaseError, e:
    print e

Watch your indentation, too. It looks like you're mixing tabs and spaces. Python's very sensitive to such things.

I've not used Vertica, but you may find answers to does anyone know the format of an odbc connection string for vertica? to be of interest.

Hope this helps.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top