How to connect to remote msmq - vb6

I am unable to connect to remote msmq using the path name "computername\queue" I am getting error
"The queue path name specified is invalid.
I am using VB6
Dim oQInfo As MSMQ.MSMQQueueInfo
'Initialize the MSMQQueueInfo object.
Set oQInfo = New MSMQQueueInfo
oQInfo.PathName = "machine\acknakq"
oQInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)

Related

ODBC Data Source Connection Successful but TNS Unresolved in VBScript

I am trying to make a connection to Oracle DB from VBScript. I've added all the environment variables and the code can locate the file of TNSNAMES.ora but cannot resolve the connection.
When I test the connectivity from the ODBC Data Source Administrator, I get a 'Success' result, but I still cannot access this from the code.
con.ConnectionString = "DSN=DATA;Uid=wh;Pwd=pwd;"
con.Open 'This is where it fails
I have tried many connection strings but all fail
OracleConnString = "Driver={Oracle in instantclient_18_3};server=server;database=db;trusted_connection=Yes;"
DB_CONN_STRING = "Driver={Oracle in instantclient_18_3}; " & _
"(DESCRIPTION=" & _
"(ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = port)" & _
"(CONNECT_DATA=(SERVICE_NAME=srv_name)))"
CONN_STRING = "CONNECT wh/pwd#//host/db"
How can I connect to the database from the script?
You mix several topics.
You hide the DSN name and the "Data Source Name", this makes it impossible for use to provide you the correct connection string.
If you like to use the ODBC DSN then the connection string must be
DSN=▇▇▇▇DATA;Uid=myUsername;Pwd=myPassword
However, you must create a System DSN, not a User DSN (see ODBC DSN). However, typically you don't use the ODBC DSN because you have to create the DSN on the target machine which is additional configuration work.
Connection string without DSN would be
Driver={Oracle in instantclient_18_3};Dbq=?????;Uid=myUsername;Pwd=myPassword;
or
Driver={Oracle in instantclient_18_3};Server=?????;Uid=myUsername;Pwd=myPassword;
see https://www.connectionstrings.com/oracle-in-oraclient11g_home1/
If you use full DB name like (DESCRIPTION=... then you don't need any tnsnames.ora file. The purpose of this file is to resolve an alias to this full DB name.
Ensure that the ODBC driver is the same architecture, i.e. 32-bit or 64-bit as your VBS environment.
Either use %windir%\system32\odbcad32.exe + %windir%\system32\cscript.exe
or %windir%\SysWOW64\odbcad32.exe + %windir%\SysWOW64\cscript.exe

What's the meaning of: "java.sql.SQLRecoverableException: I/O-Error: Unknown host specified" if TNS-alias specified

Using Oracle JDBC driver with TNS-alias instead of host:port:SID a'la
jdbc:oracle:thin:#TNS_ALIAS
you may get this error message
java.sql.SQLRecoverableException: I/O-Error: Unknown host specified
while calling
java.sql.DriverManager.getConnection
But there is no problem with the hostname specified by TNS-alias.
Sadly this error message does not point to the real reason:
The error occurs if driver cannot find the tnsnames.ora config file.
Solution
You have to ensure that system-property "oracle.net.tns_admin" is set before connecting and points to the directory containing the tnsnames.ora.

cx_Oracle connection by python3.5

I've tried several attempt to connect Oracle DB but still unable to connect. Following is my code to connect. However, I could connect Oracle DB through the terminal like this:
$ sqlplus64 uid/passwd#192.168.0.5:1521/WSVC
My evironment: Ubuntu 16.04 / 64bit / Python3.5
I wish your knowledge and experience associated with this issue to be shared. Thank you.
import os
os.chdir("/usr/lib/oracle/12.2/client64/lib")
import cx_Oracle
# 1st attempt
ip = '192.168.0.5'
port = 1521
SID = 'WSVC'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
# dsn_tns = cx_Oracle.makedsn(ip, port, service_name=SID)
db = cx_Oracle.connect('uid', 'passwd', dsn_tns)
cursor = db.cursor()
-------------------------------------------------
# 2nd attempt
conn = "uid/passwd#(DESCRIPTION=(SOURCE_ROUTE=OFF)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.5)(PORT=1521)))(CONNECT_DATA=(SID=WSVC)(SRVR=DEDICATED)))"
db = cx_Oracle.connect(conn)
cursor = db.cursor()
------------------------------------------------------
# ERROR Description
cx_Oracle.InterfaceError: Unable to acquire Oracle environment handle
The error "unable to acquire Oracle environment handle" is due to your Oracle configuration being incorrect. A few things that should help you uncover the source of the problem:
when using Instant Client, do NOT set the environment variable ORACLE_HOME; that should only be set when using a full Oracle Client or Oracle Database installation
the value of LD_LIBRARY_PATH should contain the path which contains libclntsh.so; the value you selected looks like it is incorrect and should be /usr/lib/oracle/12.2/client64/lib instead
you can verify which Oracle Client libraries are being loaded by using the ldd command as in ldd cx_Oracle.cpython-35m-x86_64-linux-gnu.so

Websphere Scripting - Error while SyncNode

Below is the jacl script which I use for syncing the Node in WAS 7.
#Sync Node Changes
puts "Begin SyncNode.."
set Sync1 [$AdminControl completeObjectName type=NodeSync,process=nodeagent,node=Profile01Node600,*]
set Sync2 [$AdminControl completeObjectName type=NodeSync,process=nodeagent,node=Profile02Node601,*]
$AdminControl invoke $Sync1 sync
$AdminControl invoke $Sync2 sync
puts "SyncNode Complete"
The environment is clustered, post deployment of the EAR file, I'm invoking this jacl script to sync the changes to Nodes.
The error I get when running the script:
WASX7209I: Connected to process "dmgr" on node wAMLDmgrNode using SOAP connector; The type of process is: DeploymentManager
Begin SyncNode..
WASX7017E: Exception received while running file "xxx/xxx/xxx.jacl"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7025E: Error found in String ""; cannot create ObjectName.
What is the reason for Sync1 being ''?
Do we need to use process=nodeagent in the command?
What will be the result if the nodeagent is started and stopped?
The error message:
WASX7017E: Exception received while running file "xxx/xxx/xxx.jacl"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7025E: Error found in String ""; cannot create ObjectName.
... tells that the ObjectName was not found. Most likely:
your nodeagent is down
there is a typo in node name (Profile01Node600 & Profile01Node601)
You can check which nodeagents (their NodeSync MBeans) are available by running this command:
$AdminControl queryNames WebSphere:*,type=NodeSync
Based on the output you can fix the typo.
If unavailability of nodeagent is the issue, then you can cater for that in your script by checking if completeObjectName returned an empty string.

ADODB Connection Problem

I am trying to perform a database operation from a VB 6.0 application (connecting to SQL 2000). The application is running fine in my local and test machines, but it gives the following error in the UAT environment.
dbConn - Nothing
lErrorNum = -2147024770
sErrorDesc = Method '~' of object '~' failed
My source code is:
Dim connectionString As String
connectionString = "DSN = {My DSN Name}"
Private dbConn As ADODB.Connection
Set dbConn = New ADODB.Connection
With dbConn
.ConnectionString = sConn
.ConnectionTimeout = 10
.CursorLocation = adUseClient
.CommandTimeout = 60
.Open
End With
The MDAC version is MDAC 2.8 SP2 ON WINDOWS SERVER 2003 SP1. (Check with CompChecker)
I have copied the source code to the UAT environment and tried running it from the IDE, but still the same error.
One possibility is that you need to install the MS SQL Client tools on the UAT server (http://msdn.microsoft.com/en-us/library/aa197918(SQL.80).aspx). Have you checked the DSN itself using the test connection option? You could also try an DSN-less connection string.
The error code is a Win32 facility error, 123 ERROR_INVALID_NAME: The file, directory name, or volume label syntax is incorrect.
Sounds like ADO isn't installed correctly.

Resources