Qt ODBC Microsot SQL Server 2014 issue which happens once a month - c++

I have developed for windows server 2016, a server application written in C++ with Qt/ODBC/MS Sql Server 2014 which works well. Users log into the application with their login/password. The server application make requests to MS SQL server thanks to ODBC driver.
But about once a month, the login functionnality stops to work and it seems that the application cannot access to the database anymore.
The login process uses this peace of code :
SQLServerConnexion::SQLServerConnexion(const std::string &dbname)
{
dbname_ = QString(dbname.c_str());
database_ = QSqlDatabase::addDatabase("QODBC", generatedUUID().c_str());
database_.setDatabaseName(dbname_);
if (database_.open()) {
qDebug() << dbname_ << "opened";
}
else {
qDebug() << "Cannot open " << dbname_;
}
}
dbname follows the following pattern "DB_NAME; MARS_Connection=YES;"
When I restart the application, users can log into the application.
I don't understand why this issue happens about once a month. Have you got some ideas to solve that issue ?

Related

Deploy Coldbox Application to an existing Adobe Coldfusion 2021 instance

I have a simple Coldbox REST application that just calls the following function and returns either 0 or 1:
function getTurnstileData(location, type, rfid){
spTurnstile = new storedProc(procedure='pr_dtr_timedata_check', datasource='dsTurnstile');
spTurnstile.addParam(type='in',cfsqltype='CF_SQL_VARCHAR', value=location);
spTurnstile.addParam(type='in',cfsqltype='CF_SQL_VARCHAR', value=type);
spTurnstile.addParam(type='in',cfsqltype='CF_SQL_VARCHAR', value=rfid);
spTurnstile.addParam(type='out',cfsqltype='CF_SQL_VARCHAR', value='');
spTurnstile.addProcResult(name='result');
result = spTurnstile.execute().getProcResultSets().result;
return result;
}
Using the coldbox server server start --rewritesEnable cfengine=adobe#2021, the application runs properly (http://127.0.0.1:56217/index.cfm/api/checkEntry?location=test&type=IN&rfid=248426891)
However, when I use the exact same code (with all the same mappings and data source) and run it in an existing Adobe Coldfusion 2021, it shows an error.
11:34:28.028 - Database Exception - in C:/ColdFusion_2021_WWEJ_win64/ColdFusion2021/ColdFusion/cfusion/CustomTags/com/adobe/coldfusion/base.cfc : line 381
Error Executing Database Query.
11:34:28.028 - Database Exception - in C:/ColdFusion_2021_WWEJ_win64/ColdFusion2021/ColdFusion/cfusion/CustomTags/com/adobe/coldfusion/base.cfc : line 381
Error Executing Database Query.
Result using existing Adobe Coldfusion Server (A)
Result using existing Adobe Coldfusion Server (B)
Is there a proper way to deploy a coldbox application to an existing Adobe Coldfusion Server instance? I cannot seem to find any information in the documentation.

QT Login Timeout expired QODBC3:Unable to connect ERROR

I am trying to connect my SQL Server to the qt project with this code
QString servername = "OLI-PC";
QString dbname = "Translator";
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setConnectOptions();
qDebug()<<"Dupa connection details";
QString dsn = QString("DRIVER={SQL SERVER};SERVER=%1;DATABASE=%2;Trusted_Connection=Yes").arg(servername).arg(dbname);
db.setDatabaseName(dsn);
qDebug()<<"Dupa set data base";
if(db.open())
{
qDebug()<<"open";
}
else
{
qDebug()<<"Error = "<<db.lastError().text();
}
And it all worked as expected. I could open the database, read from it, perform certain queries, but not after I used a VPN, I can no longer connect to the database.
I have tried to disconnect from the VPN but with no success I still cannot connect.
The error code is:
One solution that worked for me was to change the driver to SQL Server Native Client 11.0:
DRIVER={SQL Server Native Client 11.0};
You can see the name of the drivers in ODBC Data Source Administrator.
check this post: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

RabbitMQ for Coveo stopped

I installed "Coveo Enterprise Search 7.0 " and "Coveo Search API " Locally on my PC "which use Window 7 OS" from link text
When I tried to start "RabbitMQ for Coveo" it always stop and log the below error in the Event views
RabbitMQ for Coveo: Erlang machine voluntarily stopped. The service is
not restarted as OnFail is set to ignore.
I tried to change the log in user for the service which is by default "Local System Account" to my domain user and the same error logged

Is it possible to run browsermob .net on aws windows jenkins/selenium 2 grid instance?

I have setup a Windows Server 2012 instance on AWS and I am running Jenkins with a Selenium grid server. The build portion goes through fine, however it is failing with a 404 when it tries to call the browserMob.NET server.CreateProxy() call. I thought perhaps it was a security port issue, so I opened 9090 and 9091 but still having the same issue. If I use the IWebDriver on my local system, everything goes through fine, but when I change over to the remoteWebDriver and point it to the AWS server and try to proxy, I get an error. If anyone has any ideas about how I might be able to go about this, I'm ready for a kick in the right direction :) Thanks!
--Edit:
Some more info: I now have Jenkins running on 8081 and now it stops with a InvalidOperationException. On the same call of server.CreateProxy() the error fired says:
"The specified domain either does not exist or could not be contacted"
Ports currently opened in IIS8 are 80, 9090, 9091, and 8080
I also downloaded the the project to the server and tried to run it from the server and I am seeing the same thing. I also am still running IWebDriver and it doesn't work. So if I run this locally on my personal Win 7 Box, it works fine, but when I run it from Windows Server 2012, it does not. This is the same project, but I have no clue as to what may be going on here.
try
{
Server server = new Server(pathToBrowserMobProxy);
server.Start();
Client client = server.CreateProxy();
client.NewHar("google");
var seleniumProxy = new Proxy { HttpProxy = client.SeleniumProxy };
var capabilities = DesiredCapabilities.Firefox();
capabilities.SetCapability(CapabilityType.Proxy, seleniumProxy);
var driver = new RemoteWebDriver(new Uri(seleniumServerUrl), capabilities);
driver.Navigate().GoToUrl("http://www.google.co.uk");
HarResult harData = client.GetHar();
driver.Quit();
client.Close();
server.Stop();
return Newtonsoft.Json.JsonConvert.SerializeObject(harData);
}
catch (Exception e) { throw e; }
So I finally figured out what was going on and thought I'd post here. The call to server.CreateProxy was using the AutomatedTester.BrowserMob .NET wrapper. This internally had a reference to a version of Newtonsoft JSON.net that was compiled as 32bit. Because of this and my Server 2012 box being 64bit, it was causing an error stating "32 bit processes cannot access modules of a 64 bit process" when it would instantiate the "Process" object. It would open the command window and then crash which would close the window and it wouldnt eb able to find the instance to conenct to. In looking at the NativeErrorCode of 299, I found this was stating that only part of a ReadProcessMemory or WriteProcessMemory request was completed. So I got the src for AutomatedTester, removed the ref to newtonsoft they were using (since this was the first 32bit ref I had found) and added the Nuget version which is compiled for Any CPU. This stopped the crash and allowed me to run my tests. Hope this helps someone else one day.

Application Failed to Initialize Properly (0xc0000142)

I'm trying to launch notepad.exe(as a simpler test) from a web service using process.Start(). This web service is deployed to IIS 5.1 on Windows XP (for development) and will likely be deployed to a Windows 2003 server with IIS 6. This is the code that I am using:
[WebMethod]
public String ReqFormImage(String qString)
{
_qString = qString;
String imageLoc = #"http://localhost/MobileService/formImages/" + NameOfScreenshot(qString);
Process myProcess = new Process();
try
{
//Credentials
myProcess.StartInfo.Domain = "domain";
myProcess.StartInfo.UserName = "myUserName"; //local admin on development pc
myProcess.StartInfo.Password = PasswordGenerate("removed");
//StartInfo
myProcess.StartInfo.WorkingDirectory = #"C:\WINDOWS\System32";
myProcess.StartInfo.FileName = "notepad.exe";
//myProcess.StartInfo.Arguments = qString;
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.RedirectStandardError = true;
//myProcess.StartInfo.LoadUserProfile = false;
myProcess.Start();
myProcess.WaitForExit();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
return imageLoc;
}
I also have impersonate set to true in the web.config (I've tried with and without my credentials in the config file, as well as with impersonate set to false). I've also given read/execute permission to my user ID, aspnet, and the service account on notepad.exe.
A breakpoint on myProcess.WaitForExit() causes a message box to pop up that says, "Application Failed to Initialize Properly (0xc0000142)." I looked at the event log and there is no further information than this.
What I need in the end is to be able to launch an exe impersonating an account that can be hardcoded or impersonating the user that accesses the web service. I know that there are issues with opening an exe with a GUI server-side, but I need this to work. I'm sure this isn't the best practice, but I am running short on time and am looking for a workaround. For now, at least getting notepad to launch will be sufficient.
Thanks for any help.
In IIS I had to set the web service to run scripts and executables, not just scripts. Notepad launches now, but without a full GUI. I don't think what I need is possible, but I solved what I asked.