Python DB Access from CGI script in Apache Web Server Issue - odbc

I have a python script that when runs outside of Apache environment (on RedHat) connects to a remote MS SQL Server via ODBC correctly and returns data as expected. It uses an ODBC driver installed at /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0 .
When running the same python code as a CGI script from Apache Web Server, there is an error that says
conn = pyodbc.connect('DSN=MY_DSN;UID=user1;PWD=pw1');
[Fri Jan 04 11:51:59 2013] [error] [client 172.19.1.136] ('01000',
"[01000] [unixODBC][Driver Manager]Can't open lib
'/opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0' : file not
found (0) (SQLDriverConnect)")
The path and file /opt/microsoft/sqlncli/lib64/libsqlncli-11.0.so.1790.0 does exist. Like I said when running the script from the shell it works fine. It fails to load the above library when executed inside the httpd.
I tried to add a Directory entry into httpd.conf, but that didn't seem to help.
How do I resolve this problem?

Related

JVM not found on cloud composer webserver

We are using JDBC Connection in airflow to fetch data from a public MySQL server. The connection was setup fine and worked as expected in the local machine but I received the following error in composer.
[Errno 2] No such file or directory: '/usr/lib/jvm'
I m currently thinking if
Am I doing something wrong ?
JVM is unavailable in Composer webserver?

Unable to start the App Server from the command line

I cloned Websphere application machine and changed the hostname by the wsadmin.sh script.
DMGR and Node started successfully but when I start the server I got this error:
ADMU0111E: Program exiting with error: java.io.FileNotFoundException: /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/CELL01/nodes/AppNode/servers/server01/server.xml (No such file or directory).
Note: I can start the server from the console only
The problem recovered after synced the node with master configuration and granted read/write permission for directive /opt/IBM/Webspere and its relative sub directives, Thanks all for your contributions and support.

Not able to connect to Oracle DB

While connecting to the DB via SQL Developer, I'm facing following error:
Io Exception: The Network Adapter could not establish the connection
I tried to find out the issue and end up seeing that the OracleXETNsListener service is not started.
I tried to start it but getting error as : The OracleXETNSListener service on local computer started and then stopped. Some services stop automatically if they are not in use by other services or programs
also tried it through command prompt as follows:
C:\Windows\system32>lsnrctl status
LSNRCTL for 32-bit Windows: Version 11.2.0.2.0 - Production on 16-JUN-2014 15:00
:43
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Message 1053 not found; No message file for product=NETWORK, facility=TNSTNS-125
57: Message 12557 not found; No message file for product=NETWORK, facility=TNS
TNS-12560: Message 12560 not found; No message file for product=NETWORK, facili
ty=TNS
TNS-00527: Message 527 not found; No message file for product=NETWORK, facilit
y=TNS
That happened to me when I set the variables ORACLE_HOME & ORACLE_SID, restarted and that error appeared.
Possible Solution: I deleted variables ORACLE_HOME & ORACLE_SID, restarted my computer and everything went ok.

glass fish 3.1.2 start failed in netbeans 7.2

I've installed Netbeans 7.2. with GlassFish Server 3.1.2 but when I run web application the default jsp page or any other jsp pages I got the error:
GlassFish Server 3.1.2 Start Failed
C:\Users****\Documents\NetBeansProjects\WebApplication3\nbproject\build-impl.xml:1022:
Deployment error: GlassFish Server 3.1.2 Start Failed See the server
log for details. BUILD FAILED (total time: 47 seconds)
build-impl.xml
< target depends="init,-init-cos,compile,
compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,
-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy,
-do-update-breakpoints" name="run-deploy"/>
< target if="netbeans.home" name="-run-deploy-nb">
< nbdeploy clientUrlPart="${client.urlPart}" debugmode="false"
forceRedeploy="${forceRedeploy}"/>
////////////////////////
glassFish Server 3.1.2
SEVERE: Shutting down v3 due to startup exception : No free port
within range:
8080=com.sun.enterprise.v3.services.impl.monitor.MonitorableSelectorHandler#788a7b
I've found the solution. My 8080 port was reserved by Oracle. So I edited the domain.xml file inside glassfish\domains\domain1\ config\domain.xml file.
I replaced the port 8080 with 9999 and replaced the file. After that I added the glassfish server to netbeans, and now it is working.
Thank You everyone.
The error message states it clearly:
No free port within range: 8080
Probably there is another instance of Glassfish (or any other server) running on your system. Try to find it out by calling http://localhost:8080 in your browser.
**Another option to solve this probs
**Enter the following on the command line:
netstat -ao
The active TCP addresses and ports will be listed — locate the line with local address “0.0.0.0:80″ and note the PID value.
Now right-click the task bar and select Start Task Manager. Navigate to the Processes tab and, if necessary, click View > Select Columns… to ensure “PID (Process Identifier)” is checked. You can now locate the PID you noted above. The description and properties should help you determine which application is using the port.
The Task Manager allows you to kill the process, but be a little wary about doing that — especially if it’s “NT Kernel & System”.**
i had the same problem.
i solved it by configuring the glassfish with jdk7 instead of jdk8.
i dont know why it wasnt working with jdk8 but now the glassfish is running.

swagger-document-override/md-override-loader - FAILED

I am able to generate code using Autorest with my api when I host it on a server 2012R2 running IIS
However when I try to run it with the localhost url I get a could not read message.
I can read swagger.json in the browser
I am using the command
autorest --input-file=https://localhost:44348/api-docs/v1/swagger.json
--output-folder=generated --csharp --namespace=DD.MyApp.Connector
The output is
AutoRest code generation utility [version: 2.0.4283; node: v10.11.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Loading AutoRest core 'C:\Users\kirst\.autorest\#microsoft.azure_autorest-core#2.0.4289\node_modules\#microsoft.azure\autorest-core\dist' (2.0.4289)
Loading AutoRest extension '#microsoft.azure/autorest.csharp' (~2.3.79->2.3.82)
Loading AutoRest extension '#microsoft.azure/autorest.modeler' (2.3.55->2.3.55)
FATAL: swagger-document-override/md-override-loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
FATAL: swagger-document/loader - FAILED
FATAL: Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
Process() cancelled due to exception : Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
Error: Could not read 'https://localhost:44348/api-docs/v1/swagger.json'.
After studying the issue on github I tried starting the api using dotnet run
but it did not help.
I tried running autorest in a dos command shell with admin priviledge
As per the github issue I can save the swagger.json to a file and generate the code by referencing the file.
That isn't a great solution.
Are you attempting to use https with localhost ? If you haven't put a certificate on there, you shouldn't be using https.
Try it with http://localhost...

Resources