VB6/VB Script connection error

Using PGNP with Microsoft .NET

VB6/VB Script connection error

Postby simeonmonera » Mon Oct 08, 2012 1:50 pm

Hi,

We are evaluating the use of PGNP driver as replacement to our PostgreSQL ODBC driver. We successfully implemented it on one of our SQL Servers linked server. However, we tried to implement it to our one legacy VB6 apps but we are getting an error. Here's the test VBScript:

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "Provider=PGNP;Data Source=NJRSDA02;Initial Catalog=rdlw_daily;User Id=gpadmin;Password=gpadmin;Extended Properties='Port=5432';"
objRecordset.CursorLocation = adUseClient
objRecordset.Open "SELECT ssn, partcpnt_last_nm, partcpnt_frst_nm, plan_num, subplan_num FROM rldf.v_partcpnt_lookup WHERE plan_num = '002003' AND UPPER(partcpnt_last_nm) = 'DOMFY' AND SUBSTRING(ssn, 6, 4) = '5932';" , objConnection, adOpenStatic, adLockOptimistic
objRecordset.Close
objConnection.Close

We are getting the error:Cannot Open DB Connection -- 80004005.

Have anybody run into the same error?

We appreciate your help.

Thanks!
simeonmonera
 
Posts: 2
Joined: Mon Oct 08, 2012 1:41 pm

Re: VB6/VB Script connection error

Postby Moderator » Mon Oct 08, 2012 9:06 pm

To obtain more details on why connection failed launch PGNP Profiler and start capture.

Also try to change adUseClient=1.
User avatar
Moderator
Site Admin
 
Posts: 297
Joined: Wed Oct 29, 2008 11:27 pm

Re: VB6/VB Script connection error

Postby simeonmonera » Tue Oct 09, 2012 10:14 am

@Moderator: Thank you! I did what you suggested and I solved the error.
simeonmonera
 
Posts: 2
Joined: Mon Oct 08, 2012 1:41 pm


Return to .NET

Who is online

Users browsing this forum: No registered users and 1 guest

cron