Question

Quelqu'un sait quels sont les paramètres pour créer une chaîne de connexion à la base de données Vertica en utilisant adodbapi? Je ne peux pas utiliser pyodbc, car il ne fonctionne pas avec IronPython.

J'ai essayé:

    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)) 

et a renvoyé une erreur opérationnelle. La même technique avec une chaîne de connexion MSSQL a bien fonctionné. Quand je crée une source de données dans Windows avec ces informations, il a également fait une connexion au Vertica.

Toute aide est appréciée.

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top