سؤال

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