Skip to content

Instantly share code, notes, and snippets.

@danielleevandenbosch
Created June 2, 2020 17:41
Show Gist options
  • Save danielleevandenbosch/160a04756636646421bd598363e60494 to your computer and use it in GitHub Desktop.
Save danielleevandenbosch/160a04756636646421bd598363e60494 to your computer and use it in GitHub Desktop.
Connect PCDMIS Basic Script to PostgreSQL
'Written by Ryan Ross, Mark Mason, and Dan Van Den Bosch for PC-DMIS basic scripting language
'to run this demo you will need to run the following in your prefered sql editor
'`create schema it; create table it.animals (animal TEXT);`
'change the connection string to suite your db, server, username, and password
Sub Main()
Dim conn As Object
Set conn = Nothing
SET conn = CreateObject("ADODB.Connection") 'late binding
conn.Open "Driver={PostgreSQL UNICODE};database=MY_DB;server=my_server;port=5432;uid=postgres;sslmode=disable;readonly=0;protocol=7.4;User ID=my_account;password=my_password;"
conn.Execute "INSERT INTO it.animals (animal) VALUES ('piggy')" '(CommandText)
conn.Close
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment