Solved

PostgreSQL Connection String Issue

Posted on 2011-03-23
3
2,574 Views
Last Modified: 2012-05-11
I recently migrated desktops. I had a vbscript that used to run on an hourly basis that had a postgresql connection string in it and that connection string seems to be giving me feedback. The only difference in systems (major noteworthy change) is that I went from PostgreSQL 8.4 to 9.0. I have verified that the drivers are in place. ODBC connection didn't seem to be necessary on my old machine. Here are the important lines from the vbscript:
Set Conn = wscript.CreateObject("ADODB.Connection")
ConnectionString = "Driver={PostgreSQL UNICODE};Server=server;Port=5432;Database=database;UID=postgres;PWD=password;"
'...some stuff gets done here...'
conn.Open ConnectionString
'...moar stuff gets done below here...'

Open in new window


And here is the error I receive upon execution:

Line: 3
Character: 3
Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Even though the error is coming from the ODBC Driver Manager, the old box doesn't have a valid odbc, nor is the odbc name specified anywhere in the original script. It all seemed to operate just fine from the connection string alone. The pg_hba.conf file has the remote connection information specified properly as well. I verified this. Anyone have any ideas? Obviously I can provide more info where necessary. Thanks in advance everyone!
0
Comment
Question by:lffit
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
m_walker earned 500 total points
ID: 35202729
while you may not need to have the odbc connection setup, it will still use the odbc framework to make the connection.  In your odbc manager is the drive name still the same.

Driver={PostgreSQL UNICODE};

as per attached image.
postgres-odbc.PNG
0
 

Author Closing Comment

by:lffit
ID: 35206134
So far that looks like it may be the answer. The driver name has changed from "PostgreSQL Unicode" to "PostgreSQL ODBC Driver(Unicode)." I have updated a test script and it seems to be functioning well now.
0
 
LVL 4

Expert Comment

by:m_walker
ID: 35206201
Glad to help.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question