Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PostgreSQL server via the ODBC drivers Hooked To VDO

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support
View previous topic :: View next topic  
Author Message
MikeR



Joined: 25 Jun 2016
Posts: 29

PostPosted: Sat Jun 25, 2016 12:59 am    Post subject: PostgreSQL server via the ODBC drivers Hooked To VDO Reply with quote

It was like pulling teeth to get this to work, so I offer this to the forum as a resource, perhaps save someone's head of hair.... javascript:emoticon('Laughing')

Download server from here: http://www.enterprisedb.com/products-services-training/pgdownload

I'm using Windows 64 bit v9.5 server.

Download ODBC drivers from here: https://www.postgresql.org/ftp/odbc/versions/msi/

I'm using the 32 bit drivers for v9.5-300.

My machine is Windows 10.

Install the server. I set it up with no password and the user "postgres" and most default options. I created a simple test database using the PgAdmin III tool, but DON'T USE THE GRAPHICAL tool to do this. If you do, it will preserve the case of all created symbols, and you will have to double-quote all table and column names in your queries to get them to work; programmatically, that means escape-double-quote them (yuck!). Use scripts instead, in the interactive SQL tool, or run them from the console tool. Then your SQL will look "normal."

Install the ODBC drivers from the MSI package.

Go into Windows ODBC Administrator Control Panel applet and define a data source on your database. Mine is a User DSN. Point it to your server and your database name. Mine is set to ANSI.

Now that the plumbing is all hooked up, this VS2015 C# code will successfully operate:

using Infralution.VirtualData;

VirtualConnection virtConn;
VirtualRecordset virtRSet;

virtConn = new VirtualConnection("DSN=PostgreSQL30; Database=myDatabaseName;", "postgres", "", -1, 5);

virtConn.CursorLocation = ADODB.CursorLocationEnum.adUseClient;
virtRSet = new VirtualRecordset();
virtRSet.VirtualConnection = virtConn;
virtRSet.TableName = "myTable";
virtRSet.PrimaryKey = "myPkey";
virtRSet.SelectClause = "select * from myTable";

Alternatively, you can set these properties in the VS2015 designer once you drop both VDO components on your form. Then, any component with data bindings (like a Data Grid) will allow you to assign the VDO component as a data source (you will see it listed as you begin to set the property for the data source), and in the case of my data grid and this particular sample select clause, the grid will be filled with any data that is stored in the table, headed by column headings that match the column names and so forth.
_________________
Thanks,

-- Mike R.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Jun 26, 2016 6:44 am    Post subject: Reply with quote

Thanks for posting that helpful info
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Data Objects Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group