VB6/VB Script connection error

  • simeonmonera
  • Topic Author
  • Visitor
  • Visitor
10 years 5 months ago #9792 by simeonmonera
VB6/VB Script connection error was created by simeonmonera
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!

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #9793 by Moderator
To obtain more details on why connection failed launch PGNP Profiler and start capture.

Also try to change adUseClient=1.

Please Log in or Create an account to join the conversation.

  • simeonmonera
  • Topic Author
  • Visitor
  • Visitor
10 years 5 months ago #9798 by simeonmonera
Replied by simeonmonera on topic Re: VB6/VB Script connection error
@Moderator: Thank you! I did what you suggested and I solved the error.

Please Log in or Create an account to join the conversation.

Time to create page: 0.135 seconds
Powered by Kunena Forum