|
Hello, i'm hoping somebody can lend me some advice on this. i'm trying to use a VBscript to create a new Manifold document, import some data into it from PostgreSQL, which i will export to a specified directory (*needs to be in .mif format, otherwise i would just use psql2shp batch program), then close the document. i will schedule this script to run so it updates the directory everynight. here is my question...when approaching manifold through scripting outside of an active manifold session, why can't i establish a connection to the PostgreSQL database? i can import a shp file from my system into the created document, then save it, but i cannot do the same from PostgreSQL. here is some example code so you can see what i'm trying to accomplish. 'VBscript set Application = createobject("Manifold.Application") set Newdoc = Application.NewDocument("", False) set shpImporter = Newdoc.NewImport("SHP") shpImporter.import "C:\SomeFile.shp" Newdoc.saveas "C:\NewDocument.map" this first simple piece of code works flawlessly, here is an example when trying to accomplish the same thing but from PostgreSQL.... 'VBscript set Application = createobject("Manifold.Application") set Newdoc = Application.NewDocument("", False) set ds = Newdoc.NewDatasource() ds.connectionType = "PostgreSQL" server = "localhost" port = "5432" username = "somename" password = "somepsswrd" database = "somedbase" ds.ConnectionString = "host='" + server + "' port='" + port + "' user='" + username + "' password='" + password + "' dbname='" + database + "'" ds.importtable("FileNameIndex") Newdoc.saveas "C:\NewDocument.map" this second example of code fails when trying to import from PostgreSQL, however the PostgreSQL import mechanism works great if i run it from the Manifold GUI. I have also tried this using Python and i run into the same problem, connection to PostgreSQL fails Note: i have both manifold 64bit and 32bit, both connect fine to postgreSQL from the GUI and i'm running build 8.0.6.0 hoping someone can understand what i'm trying to accomplish and shed some light on how i might be able to make this work thanks t-crow
|