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.
Related
I need help on connecting Oracle Autonomous Database to my .net core mvc app,
has any one tried it or aware about it.
Thanks in Advance
Thank You
Shubham Pratap
Too long for comments.
Download and extract Oracle cloud wallet.Make a backup copy of tnsnames.ora file.Shorten the names of your autonomous database entry(this step is optional.
Add the path of cloud wallet directory in sqlnet.ora
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
SSL_SERVER_DN_MATCH = yes
WALLET_LOCATION =
(SOURCE =
(METHOD = file)
(METHOD_DATA =
(DIRECTORY = "c:\OracleCloudWallet")
)
)
2) Shorten name of autonomous database entry of your choice in tnanames.ora (this step is optional just for convenience sake)
tnsnames.ora file (actual instance name is lengthy over 50 characters)
adw_high = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx))(connect_data=(service_name=xx))(security=(ssl_server_cert_dn="CN=xxx,......")))
adw_low = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx))(connect_data=(service_name=xxx))(security=(ssl_server_cert_dn="CN=xxx,......")))
adw_medium = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=xxx))(connect_data=(service_name=xxx))(security=(ssl_server_cert_dn="CN=xxx,............")))
3)Create system variable for TNS_ADMIN and directory path to cloud wallet directroy
If you set up tns_admin variable properly
from command prompt C:\echo %TNS_ADMIN% should print correct path
4)If all above steps setup properly then you should be able tnsping each entry in tnsnames.ora
Connection string in your code shoulld be like this
// Configure ODP.NET connection string
//Data Source is nothing but adb entry in tnsnames.ora i,e adw_high
optionsBuilder.UseOracle(#"User Id=xxx;Password=xxxxxx;Data Source=adw_high");
// Set TnsAdmin value to directory location of tnsnames.ora and sqlnet.ora files
OracleConfiguration.TnsAdmin = #"c:\OracleCloudWallet";
// Set WalletLocation value to directory location of the ADB wallet (i.e. cwallet.sso)
OracleConfiguration.WalletLocation = #"c:\OracleCloudWallet";
Edit:-
Today Fired up ADW instance and connected without any problem.I have Oracle 19c local instance.
ASP.NET Core Web Application relevant code
OracleConfiguration.TnsAdmin = #"C:\app\oracle\product\19.3.0\db_1\network\admin";
OracleConfiguration.WalletLocation = #"C:\app\oracle\product\19.3.0\db_1\network\admin";
string conString = "User Id=scott;Password=xxxx;Data Source=adw_low";
After the last Windows/Office update Feb 2020 on some of the computers the following connection string in vb6 produces an
"Catastrophic Failure : (10001)"
ConnectionString = "provider=microsoft.ace.oledb.12.0;DataSource="+cMDBFile
After installing MicrosoftDatabaseEngine2010 (32bit) the error was gone, but only until the next Windows Restart/Windows Update.
After changing to
ConnectionString = "provider=microsoft.jet.oledb.4.0;DataSource="+cMDBFile
it seems to run.
My MDBFile Format is ACCESS2003
The connection is created as follows:
Dim objConn as ADODB.Connection
Set objConn = new ADODB.Connection
With objConn
.ConnectionString = "provider=microsoft.ace.oledb.12.0;DataSource="+cMDBFile
.Open
End With
The Error Occurs at .Open.
Does anybody know what happened?
The last years no error occurred (except 3420 in December of course).
Is this an error produced by Microsoft, if so, how can I tell them?
You connection string should according to your database type.
more likely when you are connection to mdb file, you should use
PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=
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
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
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)