문제

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