Status for connector session is: 1544 Message: Code # 0 Connector Message: Error: Cannot find Connector 'DB2' - 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!

Related

Error Running Bulk Metric create script in command manager Microstrategy

I'm trying to run the script below in the command manager, and I'm getting the error messages below. The script is supposed to bulk create a bunch of metrics from facts in another folder. Can someone please tell me what I'm missing. I'm new to running scripts in command manager.
Script:
//list all metrics in the project
String sProjectName = "ProjectName";
String sFactFolder = "\Schema Objects\Facts\FolderName";
String sMetricFolder = "\Public Objects\Metrics\BulkTest";
ResultSet oFacts = executeCapture("LIST ALL FACTS IN FOLDER '" + sFactFolder + "' FOR PROJECT '" + sProjectName + "';");
oFacts.moveFirst();
while (!oFacts.isEof() )
{
//get name and path of this metric to list properties
String sFactName = oFacts.getFieldValueString(DisplayPropertyEnum.NAME);
//get properties of each metric
EXECUTE("CREATE METRIC "" + sFactName + "" IN FOLDER "" + sMetricFolder + "" EXPRESSION 'sum([" + sFactName + "])' ON PROJECT "" + sProjectName + "";");
oFacts.moveNext();
}
Errors:
Syntax error at line '2', column '4'. Expected: ADD, ALTER, APPLY, APPEND, ACTIVATE, BULKSAVEBEGINS, BULKSAVEENDS, CLEAR, CONNECT, CREATE, DEACTIVATE, DELETE, DISCONNECT, DISABLE, ENABLE, GET, GRANT, IDLE, IMPORT, INVALIDATE, KILL, LIST, LOAD, LOG, PUBLISH, PURGE, REGISTER, REMOVE, REPLACE, RESTART, RESUME, REVOKE, RUN, SEND, SET, START, STOP, TAKE OWNERSHIP, TRIGGER, UNLOAD, UNLOCK, UNREGISTER, UPDATE, VALIDATE, RESET, LOCK, EXECUTE, EXPIRE
Task(s) execution completed with errors.
Execution Time: 00:00:00
If you’re running that directly in Command Manager, it will fail, because it’s Java. You’ll need to create a procedure with that code, and call the procedure from Command Manager. The documentation should cover that process I think.
Use Procedure and type (do not paste the code) that code in there.
Also, change the Execute command as below.
EXECUTE("CREATE METRIC '" + sFactName +
"' IN FOLDER '" + sMetricFolder +
"' EXPRESSION 'sum([" + sFactName + "])' ON PROJECT '" + sProjectName + "';");
oFacts.moveNext();
It works.

How to automate VPN connection on Windows 10

I'm going to be traveling for the next month, and I'd like to automate the VPN connection process so that on X event, the script fires and automatically connects me. I've already configured the [L2TP/IPSec] VPN connection in ms-settings:network-vpn & verified it works, but it's automation step that's proving problematic.
Windows GUI: The credentials have been saved.
PowerShell: The RememberCredential property is set to True
VBScript: Curiously, the VPN connection is hidden:
Dim oShell : Set oShell = CreateObject("Shell.Application")
Dim NetConn : Set NetConn = oShell.Namespace(49)
Dim Connections : Set Connections = NetConn.Items
wscript.echo "Connection Count [" & Connections.Count & "]"
For i = 0 to Connections.Count - 1
wscript.echo "Connections.Item(" & i & ").Name: [" & Connections.Item(i).Name & "]"
next
rasdial <entry>: Expectedly returns error 691.
rasphone -d <entry>: Displays the Connection dialog whereas I'd prefer it to just connect automatically and hidden.
Is this even possible in Windows 10? Or am I just overlooking some small yet key detail?
I ended up leveraging Add-VpnConnectionTriggerApplication to trigger an automatic connection of the VPN on the launch of specific executables/UWP applications. The downside is that when doing this, PoSh warns that SplitTunneling must be enabled which is less than ideal.
However after playing around with it for a while (just 2 or so hours now) to ensure the VPN keys off specific executables/UWP's, I ended up disabling SplitTunneling and, paradoxically, it appears to continue working as I would hope/expect. I rebooted a few times, logged on and sure enough by the time the desktop loaded the VPN had been established.
I need to do more testing to confirm, but this is sufficient to help save me from myself.
I do this by checking the Remember my sign-in info checkbox when I created the VPN connection.
You can check this in your PowerShell script by ensuring that Get-VpnConnection returns RememberCredential : True.
If this is the case, then rasdial should automatically connect it.
I do it with this:
<#
.SYNOPSIS
Ensures vpn connection (assumed to have saved credentials) is connected.
#>
function Connect-Vpn
{
[CmdletBinding()]
param (
[object]
$Settings
)
$rr1 = Get-VpnConnection -Verbose:$false | where {$_.ServerAddress -imatch $Settings.VpnConnectionPattern -and $_.RememberCredential} | Select -First 1
if ($rr1.ConnectionStatus -ne 'Connected')
{
rasdial.exe $rr1.Name
If (-not $LASTEXITCODE)
{
throw "Cannot connect to '$($rr1.Name)'."
}
}
else
{
Write-Verbose "Already connected to '$($rr1.Name)'."
}
}
You will have to massage this code to your needs as this uses some fields from my settings file...

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?

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

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

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.