Debugging an Oracle PL/SQL WEB Application hangs browser and dev tool - visual-studio

I am fairly new to PL/SQL and have been assigned to maintain a PL/SQL system that uses WEB pages generated with PL/SQL as a front end (PL/SQL Web Application?). Because of the complexity of the application, I am trying to get the debugger from Oracle Developer Tools for Visual Studio (11.2.0.3.15) or Oracle's SQL Developer working.
I can not kick off the application from the development environment, so I am using the
DBMS_DEBUG_JDWP.CONNECT_TCP('10.15.1.177', '4000') and DBMS_DEBUG_JDWP.DISCONNECT() procedures in the package that I am trying to debug.
When the Oracle debug listener is started in Visual Studio, Tools -> Start Oracle External Application Debugger, this message appears in the output window:
PL/SQL Debugger starts. PL/SQL Debugger is listening on host:
10.15.1.177 and port: 4000.
In Oracle SQL Developer this message is shown
Debug listener (port=4000 Timeout=0 Local address=10.15.1.177)
Using Visual Studio, If the webpage is accessed and there are no breakpoints, the following messages appears the output window.
A database has connected to the PL/SQL Debugger on host: 10.15.1.177
and port: 4000. The thread 0x1 has exited with code 0 (0x0). A
database has disconnected from the PL/SQL Debugger on host:10.15.1.177
and port: 4000.
If there is a break-point anywhere in the package, before, between, or after the DBMS_DEBUG_JDWP statements, both the WEB browser and the development environment hang. Visual Studio sits with "Not Responding" until it is terminated.
In Oracle SQL Developer the WEB page hangs. If the listener is stopped then the web page can not be displayed because there is no listener available.
I do not have control over the Oracle server, but since it established a connection, I assume there is no firewall blocking the port.?
Does someone have an idea what I missed?
I have been told that you can not debug PL/SQL packages that generate web pages, but have not found any documentation indicating that is a problem.

I have been working with mod_plsql for quite some time and in my personal experience the best (if not only) way to debug such an application is to instrument your source code.
The debugger(s) works fine for pl/sql code that can be execute outside the browser but for code the interacts with mod_plsql it is in my experience best to instrument the code with tracing and logging message and use them to follow the program flow.
We use a quite sophisticated logging framework but it all comes down to a simple table where to store the log messages and an (autonomous) procedure that inserts log messages in this table.
Example:
CREATE TABLE logtab (id NUMBER, when DATE, text VARCHAR2(2000));
CREATE SEQUENCE logseq;
CREATE OR REPLACE
PROCEDURE dolog(text IN VARCHAR2)
IS
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
INSERT INTO logtab (id, when, text) VALUES (logseq.NEXTVAL, SYSDATE, SUBSTR(text, 1, 2000));
COMMIT;
END dolog;
/
EXECUTE dolog('test');

Related

attach vb6 application with sql server process

I have front end designed in VB6.I have database as Sybase server.
I am debugging vb6 application to fix one issue,i want to attach the vb6 application with sybase server so that the debugger gets attached with the stored procedure at the time of debugging itself.
I am not able to debug the back end stored procedure from the front end UI.
Please help me out .
thanks,

OCISessionBegin hangs in multithreaded COM+ applications [Delphi + ODAC + Oracle]

We have here a application that uses ODAC components inside COM+ dlls to connect to Oracle Server 11g.
Lately we are facing a problem that we cannot find the solution.
For some reason, when the concurrency of the application server at some of our clients is too high, some dlls starts to hang and they have to kill the process to restore the usability of our product. Trying to reproduce the error here at our office, we created a test environment to stress an application server. We start 30-50 programs that make calls to application and after some time the problem appears.
Debugging our DLL after the server hangs, shows that any subsequent call to OCISessionBegin cannot complete. No error is generated. No other symptoms are visible.
The last line that the we try to execute is: Check(OCISessionBegin(...)); on OraClasses.pas
We checked the database no contention, no lock.
We are using ODAC 6 on our clients, but we upgraded it to the last version and the problem persists. We have to use the Oracle Client 10 to connect to the database 11g because the are using the version 6 of ODAC.
Thanks a lot
AFAIK you need to create your environment with both OCI_EVENTS + OCI_THREADED attributes sets, in such a configuration.
For instance, here is how it is initialized in our Open Source direct Oracle access unit:
fEnvironmentInitializationMode := OCI_EVENTS or OCI_THREADED;
...
with OCI do
try
if fEnv=nil then
// will use UTF-8 encoding by default, in a multi-threaded context
// OCI_EVENTS is needed to support Oracle RAC Connection Load Balancing
EnvNlsCreate(fEnv,Props.EnvironmentInitializationMode,
nil,nil,nil,nil,0,nil,OCI_UTF8,OCI_UTF8);
I suspect you have to check how your OCI environment is created in ODAC.

Get Oracle application server address

In Oracle Forms and Reports, is there existing any function or procedure or possibility to get application server's address.
For example:
http://hostname:portno/servlet/RWServletserver=repserver+report=ReportName+destype=cache+userid=ConnectString+desformat=htmlcss
And I want to get this part: http://hostname:portno
Or Maybe there is possibility to create link of application in other way, not by knowing address of application server?
The link is to the Excel file which is created by report. The link in top is just an example and it is not link to the file. the path to the file is known.
I have a partial solution for you - the following piece of Forms PL/SQL code will return the IP address of the application server :-
declare
v_ip_address varchar2(20);
--
begin
select SYS_CONTEXT('USERENV','IP_ADDRESS') into v_ip_address from dual;
--
end;
The caveat to this functionality is that the Form / Report must be connected to a database to use this, as it uses a database function. However, it will always return the IP address of the application server, not the database server; and has been tested where these are on different boxes.
SYS_CONTEXT is an Oracle database function (confirmed available in 9i, 10g and 11g) which returns the value of a parameter associated with the context namespace; it comes with a built-in namespace USERENV. This namespace has a number of interesting and useful parameters; see http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions165.htm#g1513460 for details.
The specific parameter being used here - IP_ADDRESS - returns the IP address of the connected client, which from the database's point of view is the application server, as this is where the Form / Report is actually executing - so you get what you need :) This should work for Reports as well as Forms, although I have not tested this.
I can't see a way of getting the port number, I'm afraid - but hopefully the above should help you.
Cheers,
Keith

Microsoft Enterprise Logging Block with Entity Framework asks for WriteLog procedure

I have a WCF service that uses Microsoft Enterprise Library Logging to log some messages to the Event Log. That works just fine.
The problem is that i want to log some messages to a table in an Oracle database. I am using the Entity Framework to communicate with that Oracle database.
The next step is a right click on the 'web.config' and choose the option 'Edit Enterprise Configuration'. I get the 'Enterprise Library Configuration' editor. In there i am trying to set the Logging Settings so that it also logs to the database, but when i add a database trace listener it´s asking me to fill in a procedure name. Do i have to add a procedure name to fill the table in Oracle? The msdn tells me to run the script that create an MSSQL database 'Logging' and some tables. But i don't have an MSSQL server, i have an Oracle server. And i don't want to use a seperate logging database, but save the logs to a single table.
Can anybody help me with this?
Kind regards
The Enterprise Library Database Trace Listener uses 2 stored procedures to write to the database: Add Category Procedure and Write To Log Procedure.
There is a SQL Server script to create the tables and stored procedures. This would have to be ported to Oracle.
Unfortunately, it looks like this does not work as easily as you would hope. See the blog post, Enterprise Library Logging to Oracle Database (this is based on EntLib 3, I believe) and the work item Cannot log to oracle Database using logging blocks for a description of some of the issues as well as some downloads to help.

Monitor and change SQL queries with SQL Server 2000

I have a database upgrade tool that is misbehaving. I would like to catch one of the queries it sends to the database and change it before it is executed.
The tool connects via ODBC.
The tool and the SQL Server are on the same Windows 2003 Server box.
Any ideas?
EDIT: (More info)
When the tool runs it dies on step 12 out of 100. It issues some bad SQL intended to create a view. I need to suppress the error message or correct the SQL before it is executed. I can't just create the view because the first thing it does it drop the view. Even then it would error because the view would already exist.
Certainly - use the SQL Profiler to intercept and record the query.
Very useful little tool that...

Resources