How do I get detailed PostgreSQL-errors in Access via ODBC? - postgresql

Is there a way to get the detailed error-messages PostgreSQL shows when running a query from command-line or a client like PG-Admin when using the ODBC-Interface-Driver?
The Err-object in Access just tells you that something went wrong but is not very helpful - I have to run the same query again in PG-Admin to see where the problem is.

Silly me! Just have to iterate through the Errors-object...
Dim errX As DAO.Error
Dim strError As String
For Each errX In DAO.Errors
strError = strError & "# >> " & errX.number & " | txt >> " & _
errX.DESCRIPTION & Chr(10) & Chr(10)
Next errX

Related

Update Patch Microsoft Graph API Planner Task Detail using JSON cURL produces error 409 conflict

I receive a 409 error when trying to update a planner task, with the following error detail ... "The attempted changes conflicted with already accepted changes. Read the latest state and resolve differences."
It seems to happen every time I try to update the planner task. I can literally create a new task, then try to update it and it immediately throws the 409 error. No one has changed anything on the Microsoft side. If I wait a few minutes, the same error occurs.
What's interesting is that if i run the update literally twice, back to back ... the second time it does accept the change without error.
The URL is: "https://graph.microsoft.com/v1.0/planner/tasks/" & $microsoftplannerTaskID
CURL OPTIONS are:
"-X PATCH " &
" -H "Authorization: Bearer " & $$userToken & """ &
" -H "Content-Type: application/json"" &
" -H "If-Match: W/\"" & $microsoftPlannerTasketag &"\""" &
" -d #$PlannerTaskDetails" &
" -D $responseHeaders" //returns error codes
the $PLANNERTASKDETAILS are:
"{ " &
""bucketId": "" & #MicrosoftBucketID & "", " &
""title": "" & #title & "", " &
""dueDateTime": "" & $dueDateTimeFormatted & "" " &
"}"
found that the issue was after an update, I need to get a new etag value before updating the same planner task again. so you need to update, then get, then update again.

In VB6, using the FilesSystemObject, how to access directories on multiple servers?

In a project we have a table with the following fields: FolderPath, FileType, DaysToKeep, ServerIP.
When the utility is executed, I read the rs from the table then want to access the [ServerIP]\[FolderPath] to see of the delta of Now() and the first file's (or a file's) last save date is greater than DaysToKeep.
I have most of the pseudo-code done and am confident in being able to do this on a local server using the FileSystemObject (importing Microsoft Scripting Runtime).
rsDirectoryList.MoveFirst
Do While Not rsDirectoryList.EOF
' Fields: FolderPath, FileType, DaysToKeep, ServerIP
Debug.Print "Values: " & rsDirectory.Fields("FolderPath").Value
' get directory contents from [ServerIP]:[FolderPath]
'fileSpec = rsDirectory.Fields("ServerIP") & rsDirectory.Fields("FolderPath")
Set f = fso.GetFile(fileSpec)
Debug.Print "Last Modified: " & f.DateLastModified & vbNewLine
' Get the date of the first file from [ServerIP]\[FolderPath]
' If Now() - FileDate in days > DaysToKeep, purge directory
'If DateDiff("d", Now(), f.DateLastModified) > rsDirectory.Fields("DaysToKeep").Value Then
' ' Delete files from specified directory
' Kill (serverIP \ FolderPath) ?????
'Else
' Debug.Print "Skipping: " & rsDirectory.Fields(0).Value & vbNewLine
'End If
rs1.MoveNext
Loop
I was thinking that I may have to create a share for each server on the utility's server and access them by drive letter, rather than by IP address.
Is there a way to do this with the given IP addresses?

Status for connector session is: 1544 Message: Code # 0 Connector Message: Error: Cannot find Connector 'DB2'

I have a database with two agents, well there are really more than two, but two that matter right now. One works, the other does not. Both have Uselsx '*lsxlc' defined in (Options).
I have commented out everything in the failing agent except
Dim s As New NotesSession
Dim db As NotesDatabase
Dim agentLog As NotesLog
Set db = s.CurrentDatabase
'agent log
Set agentLog = New NotesLog("Customers from Aging Report - AKM")
Call agentLog.OpenNotesLog( db.server, "agentinfo.nsf" )
agentLog.LogActions = True 'Set to True/False to turn on/off action logging
agentLog.LogErrors = True 'Set to True/False to turn on/off error logging
Call agentLog.LogAction("Start Agent: GetCustomerDataBasedOnAging")
On Error Goto throwError
Dim lcses As New LCSession
Dim src As New LCConnection(COutConn)
%REM
....
%END REM
Exit Sub
throwError:
'Error code
Dim epos As String
Dim emsg As String
Dim msg As String
Dim result As String
Dim status As Integer
Dim msgcode As Long
If lcses.status <> LCSUCCESS Then
status = lcses.GetStatus (result, msgcode, msg)
Call agentLog.LogError( msgcode,"Status for connector session is: " & Cstr(status) & Chr(10) & "Message: " & msg & " Code # " & Cstr(msgcode) & Chr(10) & "Connector Message: " & result )
emsg = "Customers from Aging Report' Agent: ("+Cstr(Erl)+") "& "[" &Cstr(Err) & "] [" & Error$ & "]"
Call agentLog.LogError( Err, emsg)
Else
emsg = "Customers from Aging Report' Agent: ("+Cstr(Erl)+") "& "[" &Cstr(Err) & "] [" & Error$ & "]"
Call agentLog.LogError( Err, emsg)
End If
Resume Next
COutConn is defined as a constant with value 'DB2'
I get the following error in the agent log:
Status for connector session is: 1544
Message: Code # 0
Connector Message: Error: Cannot find Connector 'DB2'
This happens whether I use the constant COutConn, or "DB2".
The strange thing is that the other agent with the same definitions works properly. I know DB2 exists on the machine, it is i5/OS v5r4. DB2 is built in on this operating system.
What else do I need to look for?
The answer is, be sure you know which machine the agent is running on. When you right click the agent in Domino Designer, and select Run, as I did, the agent is not running on the server that the database resides on, but rather inside the Domino Designer client. that is going to be Windows or Linux depending on your workstation.
So why did the one agent work while the other did not? Well the one that worked was activated from a button in the Notes Client, and the function attached to the button used Run on Server. The server was indeed IBM i. However, in the case of the failing agent, I executed that one from within Domino Designer as mentioned above, thus no DB2 connector.
Here's to hoping someone can learn from my pain!

CreateObject in VB Script fails with no error message

I have deployed a 64-bit COM+ application and while trying to create an instance of it via script, it fails with no error message and a negative error code (-2146233036).
The script:
dim myObj on error resume next set myObj = CreateObject("TestApp.1")
if (Err.number <> 0)
then MsgBox Err.Number & " " & Err.Message
end if
if (myObj is nothing)
then MsgBox "Null" else MsgBox "Not Null"
end if
Essentially I was trying to troubleshoot of why CoCreateInstanceEx was failing for the same. How do I find out what happens behind the scene? At which step is it failing?

Recommended solution for scripting file operations over WebDAV?

I have a task: files available over WebDAV on a remote server (SSL required) must be checked for whether they may have been updated recently, and if so copied to a local folder. There are a number of other actions that need to be performed after they arrive (copied to other folders, processed, etc.). The operating system I'm working from is Windows 2003 Server. I'd love to be able to use PowerShell for this task.
Naturally, I need to browse the files. I've looked tentatively at several solutions:
Trying to map a drive using "net use" (so far, I get a system 67 error)
Using a product like WebDrive to map a drive (as it happens, WebDrive and another utility on the server seem to conflict with each other for mysterious reasons)
Browse and manipulate the files by issuing http requests using the .NET HTTPWebRequest object hierarchy through PowerShell (works, but seems a bit complicated)
Purchase a commercial .NET assembly that simplifies working with WebDAV (ones that I've seen look pricey)
Have you needed to do something similar? Which approach is best? Any that I have missed? TIA.
It will work from powershell. Note this example:
http://thepowershellguy.com/blogs/posh/archive/2008/05/31/cd-into-sysinternals-tools-from-powershell.aspx
The problem is that the 'web client service' not running on the windows 2003 server (it's disabled by default).
The clue was the "System 67 error"
I confirmed this from a win2k3 server, starting the 'web client service' will get WebDAV working (and probably powershell). It will work out of the box on an XP client (service is running by default).
Let me know if this doesn't resolve it for you.
As an alternative to PowerShell, you could always do this from a WSH script. Example:
<job>
<reference object="ADODB.Connection"/>
<object id="cnIPP" progId="ADODB.Connection"/>
<object id="recDir" progId="ADODB.Record"/>
<script language="VBScript">
Option Explicit
Private waArgs
Private strSubDir
Private rsItems
Private strLine
Set waArgs = WScript.Arguments
If waArgs.Count < 3 Then
WScript.Echo "Parameters: FolderURL User PW [SubDir]"
WScript.Quit
End If
cnIPP.Open "Provider=MSDAIPP.DSO;Prompt=NoPrompt;" _
& "Connect Timeout=10;" _
& "Data Source=" & waArgs(0), _
waArgs(1), waArgs(2), adConnectUnspecified
If waArgs.Count = 4 Then
strSubDir = waArgs(3)
Else
strSubDir = vbNullString
End If
Set waArgs = Nothing
recDir.Open strSubDir, cnIPP, adModeRead, adFailIfNotExists, _
adDelayFetchFields Or adDelayFetchStream
Set rsItems = recDir.GetChildren()
With rsItems
WScript.Echo .Fields("RESOURCE_PARENTNAME").Value
Do Until .EOF
If .Fields("RESOURCE_ISCOLLECTION").Value Then
strLine = " [DIR] " & .Fields("RESOURCE_PARSENAME").Value
Else
strLine = " " _
& " " & .Fields("RESOURCE_PARSENAME").Value _
& " " & CStr(.Fields("RESOURCE_LASTWRITETIME").Value)
End If
WScript.Echo strLine
.MoveNext
Loop
.Close
End With
Set rsItems = Nothing
recDir.Close
cnIPP.Close
</script>
</job>
A sample run:
D:\Scripts>cscript WebDAV.wsf https://my.dav.com/~fred fred fredPW
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.
https://my.dav.com/~fred
junk.htm 2/26/2008 4:28:44 AM
test.log 3/30/2009 12:30:45 PM
[DIR] _private
[DIR] stuff
D:\Scripts>
This approach should work with both WebDAV and FrontPage enabled servers without change. The example defaults to protocol auto-negotiation.
To actually retrieve data you'd open an ADODB.Stream on an ADODB.Record opened on the non-directory item.