ADO fails to access oracle in win10 - oracle

My company has long been using ADO to communicate with database, Oracle 10 or 11 typically. This has been working fine in win7 or Windows XP era. But recently some software running on Win10 or Win7 with IE updating from IE8 to IE11 couldn't connect to database with ADO. The code and error is as follow:
_ConnectionPtr m_pConnection;
try
{
hr = m_pConnection->Open(_bstr_t(m_strConnection), _bstr_t(lpstrUserID), _bstr_t(lpstrPassword), NULL);
return hr == S_OK;
}
catch(_com_error &e)
{
dump_com_error(e);
return FALSE;
}
It works fine in win7 but throws exception in win10, the exception object gives information as follow:
_com_error &e:
m_hresult = E_FAIL
[0] = 0x536a8590 _com_error::`scalar deleting destructor'(unsigned int)
m_perrinfo = 0x013aaaa0
IUNKOWN
__vfptr = 0x532d120c
[0] = 0x533001e0
[1] = 0x533003c0
[2] = 0x532fedc0
m_pszMsg = 0x00000000 <Bad Ptr>
And the description in the exception object is:
CADODataBase Error
Code = 80004005
Code meaning = undefined error
Source = OraOLEDB
Description = ORA-12154: TNS: unable to resolve given connection identifier
What could lead to this problem and how could I fix it? Thanks.

Related

how to connect MS Access (x86) DB using Microsoft Jscript running in x64 bit Environment

I am trying to connect an MS Access (x86) database (*.mdb) from a third party application which is x64 bit and supports Microsoft JScript ...
My Code Looks like below:
function testaccess(sender : System.Object, cmdArgs : Ico.Gwx.CommandExecutionEventArgs)
{
try
{
strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\EC_SCADA\\Configurations\\ModbusEthernetConfig\\EC_ModbusOPC_Config.mdb;Persist Security Info=False";
var cnn = System.Data.OleDb.OleDbConnection;
var cmd = System.Data.OleDb.OleDbCommand;
var qr1 : String = "Select IPAddress from Devices where Name = 'Machine1'";
var da : System.Data.OleDb.OleDbDataAdapter;
var dt : System.Data.DataTable;
//MessageBox.Show("Variables defined");
cnn = new System.Data.OleDb.OleDbConnection(strConnectionString);
//MessageBox.Show("cnn defined");
cmd = new System.Data.OleDb.OleDbCommand(qr1, cnn);
//MessageBox.Show("cmd defined");
da = new System.Data.OleDb.OleDbDataAdapter(cmd);
cnn.Open();
MessageBox.Show("Connection Opened");
da.Fill(dt);
MessageBox.Show("Code End");
}
catch (e)
{ MessageBox.Show("OOPS!!! something went wrong, Kindly try again!!!!");
}
}
First of all the Code editor itself throws error at line "da = new..." as "More than one constructor matches this argument list"
Can anyone help on this??
I found couple of issues here.
[1] missed to define dataTable like
"dt = new System.Data.DataTable"
[2] I downloaded and installed "Microsoft Access Database Engine 2010 Redistributable - 64 bit" from Below link, installed on my computer and the code just works fine.
[https://www.microsoft.com/en-gb/download/details.aspx?id=13255]

MSMQQueueManagement error when creating a class instance

I have a routine to get the counts on a MSMQ queue. I have been using this code for years on 2003 and 2008 server with no trouble. I am now updating the code to run on 2012R2 server and to test this I am compiling with VS2013 premium on Windows 8.1 using the following code:
String sPath;
Int32 nCount = 0;
Object oPath, oNull, oServer;
String [] sParts;
Char [] sSeps = { ':', '\\' };
MSMQ.MSMQQueueManagementClass mgmt;
//
// The configuration path is a standard .net path. For DCOM we need the
// DIRECT= prefixed
//
sPath = "DIRECT=OS:" + m_QueueConfig.QueuePath;
//
// Split the string looking for the sever name
//
sParts = sPath.Split( sSeps, StringSplitOptions.RemoveEmptyEntries );
//
// Get the count from the server
//
mgmt = new MSMQ.MSMQQueueManagementClass();
try
{
oPath = sPath;
oNull = Type.Missing;
if( sParts.Length < 2 || sParts[1] == "." )
oServer = Environment.MachineName;
else
oServer = sParts[1];
mgmt.Init( ref oServer, ref oNull, ref oPath );
nCount = mgmt.MessageCount;
}
catch( Exception )
{
nCount = 0;
}
finally
{
Marshal.ReleaseComObject( mgmt );
}
return nCount;
This will error on the "mgmt. = new MSMQ.MSMQQueueManagementClass()" statement with the following error:
Retrieving the COM class factory for component with CLSID {33B6D07E-F27D-42FA-B2D7-BF82E11E9374} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Looking in the HKEY_CLASSES_ROOT hive I can find 39CE96FE-F4C5-4484-A143-4C2D5D324229 which pointed to the MQOA.DLL in system32, but not the CLSID from the error, which is what a 80040154 is.
I have tried creating a new typelib using the system32/mqoa.dll but I still get the same error. So what I am doing wrong?
According to the registry I have MSMQ version 6.2.9200 installed and it works with my application I just can't get the management interface to load.
mgmt.Init( ref oServer, ref oNull, ref oPath );
The MSMQQueueManagement interface does not have an Init() method. Looks to me like you are mixing up different coclasses. The 39CE96FE guid is for MSMQManagement, the 33B6D07E guid is for MSMQQueueManagment. The latter one is not supposed to appear in the registry so the runtime error is entirely expected. Fix:
mgmt = new MSMQ.MSMQManagement();
// etc..

Calls to a COM Server succeed under administrator account but fail under SYSTEM account

I am trying to query some data from a COM server (actually the Motorola MeshAPI), but it fails to initialize. Using the code snippet below, I get successful data when running on the command line as Administrator, but my actual program using this code runs as a service under the SYSTEM account. Using "psexec -i -s cmd.exe" I ran the snippet under the SYSTEM account, and I get the same errors I saw with the service.
It is the CreateInstance() call that fails, with an error message "Server execution failed" and error code 2148007941 (0x80080005).
Under the Windows Event Viewer, in the System pane I see errors with source "DCOM", event ID 10010, and description "The server {....GUID} did not register with DCOM within the required timeout."
I've tried the tips from this answer https://stackoverflow.com/a/1157331 , but I haven't found anything helpful in solving this.
What would cause this to work under Administrator but fail under SYSTEM, and how can I get it to work when running under SYSTEM?
HRESULT hr=S_OK;
USHORT nLinkResistance;
if (!m_MeshNetInitialised)
{
hr = m_pApiCardInterface.CreateInstance("MeshAPI.MeshNet");// mea interface smart pointer
if (SUCCEEDED(hr))
{
Sleep(1000);
m_MeshNetInitialised = true;
}
}
if (m_MeshNetInitialised)
{
hr = m_pApiCardInterface->GetIAPLinkResistance(&nLinkResistance);
if( SUCCEEDED(hr) )
{
l_retval = nLinkResistance;
}
else
{
std::wcout << L"Error getting IAPLinkResistance" << std::endl;
}
}
if (FAILED(hr))
{
_com_error err(hr);
std::wcout << err.ErrorMessage();
}

WATIN-Run script Problem in IIS

I am using watin framwork. I have wrote code ie.Runscript('newnote()'); Its running in my pc IIS success. This code also runnign with client visual studio 2008 with success but failed with client IIS. I have also set all rights in IIS and web folder. also check with IE7 and IE8. We have verfied with SSL certificate.But we can not identify where is problem.
please, help me.
Error: (1) Run script failed. and some time (2)Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
Code Like:
string mfnQS='45SDS82'
string noteURL = string.Format ("https://sitename.co.uk/apps/shared/dlg_addnoteform.jsp?{0}&parent_package=cxa&cid=", mfnQS);
ie.GoTo(noteURL);
ie.WaitForComplete(2000);
Thread.Sleep(2000);
objBO.NoteDetails = objBO.NoteDetails;
string sNote = StringUtility.RemoveHtmlTag(objBO.NoteDetails);
TextField notetext = ie.TextField(Find.ById("notetext"));
notetext.WaitUntilExists(2000);
notetext.Value = sNote;
notetext.WaitForComplete();
ie.RunScript("$('iframe').contents().find('html body').html(document.addnote.notetext.value)");
WatiN.Core.Button btnAdd = ie.Button(Find.ByValue("ADD NOTE"));
if (btnAdd.Exists)
{
if (ClsReadOnlyKeyword.IsFinalVersion)
{
ie.RunScript("newnote();");
Thread.Sleep(2000);
isTrue = true;
}
}

SAP Business One: Connection Error When I try to connect to UI API

I got this error message
"Connection - Could not find SBO that match the connection string [66000-85]"
when I try to connect SAP Business One UI API.
I connect like the following :
private void SetApplication()
{
SAPbouiCOM.SboGuiApi SboGuiApi = null;
string sConnectionString = null;
SboGuiApi = new SAPbouiCOM.SboGuiApi();
// connect to a running SBO Application
sConnectionString = Environment.GetCommandLineArgs().GetValue(1).ToString() ;
SboGuiApi.Connect(sConnectionString);
SBO_Application = SboGuiApi.GetApplication(-1);
}
I got it this problem, my connestring string is wrongly config. WHen I set rigth one it works now. Thanks all.

Resources