georeference.org
Subscribe to this thread
Home - Scripting / All posts - Question regarding VBscript, Manifold, and connecting to PostgreSQL
t-crow
40 post(s)
#29-Apr-08 14:07

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

 

 

AR_Rick

127 post(s)
#29-Apr-08 14:22

Copy the PostgreSQL client DLL libraries into c:\windows\system32.


Need industrial grade Manifold hosting? Scaling, Load Balancing, Special Tuning, etc. Drop me a line.

t-crow
40 post(s)
#29-Apr-08 15:03

Rick,

thanks, this seems to have solved the problem, also seems to have cleared up my error with python also.

lionel_

595 post(s)
#27-Aug-08 06:49

1)seem there is a better way to register dll/ocx wihtout move the dll to C:\window\system32

is to use regsvr32 with option or use it with contextual menu after install the *.reg file

then when go to the directory where dll is locate you could use the contextual menu

2) this make me think about gacutil is look like very similar

http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=713

http://www.nirsoft.net/dot_net_tools/gac_viewer.html

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=718831&SiteID=1

Attachments:
regsevr0.jpg

lionel_

595 post(s)
#27-Aug-08 07:05

ocx dll

dll .net

.Net dll

AR_Rick

127 post(s)
#03-Sep-08 07:25

The PostgreSQL DLLs aren't COM libraries or .NET assemblies, they're just regular procedural DLLs, so they need to be in the correct search path.


Need industrial grade Manifold hosting? Scaling, Load Balancing, Special Tuning, etc. Drop me a line.

lionel_

595 post(s)
#04-Sep-08 07:56

yes see discover that don't work after i writing this .so was aware of the problem but can 't know the reason .is there tutorial on the net that explain how many type of dll exist ? don't have the good/suit words that ll return the best link in search engine .

""A procedural object is created by an algorithm that takes a set of parameters that define the object and produces the object representation from that set."""

=> all object is create by function ( initialisation affectation) so difficult to understand !

know language oriented and procedural but not dll !!

does it refer to the language/registry prameters ?

2 msec Copyright (C) 2007-2008 Manifold.net. All rights reserved.