Print out sql statement
Is there any way to print out a sql statement to a window when using on session?
I have a sql select statement which looks like the following:
SQL SELECT * FROM table_name
WHERE column_a = :Value1
ON SESSION lDBSession;
I would like to be able to pring out the statement that was actually executed.
Does anyone have any ideas how this can be done without rewriting the sql?
Thanks,
KRC
Try trace flags
trc:db:2:1 prints all the sql statements processed by the database session
trc:db:2:50 shows input values for the sql statement
On the DB Sessiob.
Similar Messages
-
SQL statement in servlet giving error
Please let me know if I need to post this on a different forum, but I thought it was applicable to here.
First, let me preface this post by saying I've inserted hardcoded values at the DB (Oracle) level and it worked just fine, so most of the statement is sound. All the values inserted properly when testing it that way. Also, I've printed the SQL statement to the console and all looks ok there, too.
Out of this, I'm getting an error citing the following:
java.lang.ArrayIndexOutOfBoundsException
also occasionally getting the following error:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
In my servlet, I'm attempting the following:
prior to the insert statement, I'm retrieving the last row number to start the increment from as in:
Statement stmt = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rst = stmt.executeQuery("select CHANGE_CTRL_ID from CHANGE_CONTROL_USER order by CHANGE_CTRL_ID");
rst.last();
int lastRowNum = Integer.valueOf(rst.getString("CHANGE_CTRL_ID")).intValue();
rst.close();
stmt.close();
------------ then ------------------------------------------------
String preparedQuery = "INSERT ALL " +
"INTO CHANGE_CONTROL_USER " +
"(CHANGE_CTRL_ID,REQUESTOR_NAME,REQUESTOR_EMAIL,BUS_CONTACT,DEPT,LOCATION,PHONE_NUM,DATE_REQ," +
"BUSVP,VP_PHONE,VP_DATE,BRANCH,PRIORITY,OPS_MAN_CHG,OPS_MAN_PPCHAP,TRAIN_REQ," +
"EXIST_SYS_FLD_CHG,BUS_RULES_CHG,NEW_CODING,NEW_BUS_RULE,NEW_SYS_FIELD,REQ_TYPE_OTHER,REQ_OTHER_SPECIFY,IMPACT_RE_COLL," +
"IMPACT_DEF_LM,IMPACT_DEF_REC_NRE,IMPACT_AUDIT,IMPACT_PERS_COLL,IMPACT_DEF_FCL,IMPACT_BUS_TECH,IMPACT_LEGAL,IMPACT_PRIV_COLL," +
"IMPACT_DEF_BKRUP_RE,IMPACT_DEC_SUPT,IMPACT_RISK_MGT,IMPACT_DEF_REO,IMPACT_DEF_BKRUP_NRE,IMPACT_QUALSVCS,IMPACT_INTERNAL_CTRL,IMPACT_DEF_WKFL," +
"IMPACT_DEF_WKOUT,IMPACT_TRAIN_TPI,IMPACT_OTHER,IMPACT_DEF_MGT,IMPACT_DEF_TAX,IMPACT_VEND_MGT,IMPACT_DEF_CTRL,IMPACT_DEF_REC_RE," +
"IMPACT_BUS_ADMIN,IMPACT_OTHER_SPECIFY,CHANGE_IN_KPMG,CHANGE_IN_OTS,CHANGE_IN_NFR,CHANGE_IN_ARR,CHANGE_IN_BRR, CHANGE_IN_PROC_IMP," +
"CHANGE_IN_INT_CITI_POL,CHANGE_IN_OTHER,CHANGE_IN_OTHER_SPECIFY, CHANGE_INIT_DETAILS,REQ_INFO_DESCRIPT,REQ_INFO_EXPLAIN_CURRBUS,REQ_INFO_EXPLAIN_PROPOSED,REQ_BEN_PROP_BENEFIT,REQ_BEN_FIN_IMPLEMENT," +
"REQ_BEN_OPS_IMPLEMENT,YES_FORM,VULN_ASSESS, CBA_CHG, RISK_ACCEPT,MARSITEM, GCCRFP, APP_COMPL_QUES,CAP_EXPEND)" +
" VALUES (changecontrol_user_seq.nextval,?,?,?,?,?,?,to_date(?,'YYYY-MON-DD HH:MI:SS'),?,?,to_date(?,'YYYY-MON-DD HH:MI:SS'),?,?," + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,"
+ "?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
+ "INTO CHANGE_CONTROL_ADMIN "
+ "(AID,CHANGE_CTRL_ID,ADMNAME,CLOSEDATE,ACTIVE)"
+ "VALUES (changecontrol_admin_seq.nextval, changecontrol_user_seq.currval,NULL, NULL, -1)"
+ "SELECT object_name AS REQUESTOR_NAME FROM all_objects where rownum <= 1;";
also I've declared all the respective strings for the PreparedQuery statement.
If you need to see those, here they are:
PreparedStatement pstmt = connection.prepareStatement(preparedQuery);
// stmt = connection.stmt("INSERT INTO RMIS_USER VALUES (?,?,?,?,to_date(?,'YYYY-MON-DD HH:MI:SS'),?,?,?,?,to_date(?,'YYYY-MM-DD HH:MI:SS')");
pstmt.setInt(1,++lastRowNum);
pstmt.setString(2,reqName);
pstmt.setString(3,reqemail);
pstmt.setString(4,buscont);
pstmt.setString(5,reqDept);
pstmt.setString(6,reqLocale);
pstmt.setString(7,phone_num);
pstmt.setDate(8,dtreq);
//pstmt.setCalendar(8,rtnow);
pstmt.setString(9,busvp_email);
pstmt.setString(10,vpphone);
pstmt.setDate(11,dt);
pstmt.setString(12,branch);
pstmt.setString(13,priority);
pstmt.setString(14,opsmanchg);
pstmt.setString(15,opsmanppchap);
pstmt.setString(16,train_req);
pstmt.setString(17,reqexist_sys_fld_chg);
pstmt.setString(18,reqbus_rules_chg);
pstmt.setString(19,reqnew_coding);
pstmt.setString(20,reqnewbus_rule );
pstmt.setString(21,reqnew_sys_fld);
pstmt.setString(22,reqother);
pstmt.setString(23,req_other_specify);
pstmt.setString(24,imp_recoll);
pstmt.setString(25,imp_deflm);
pstmt.setString(26,imp_defrecnre);
pstmt.setString(27,imp_audit);
pstmt.setString(28,imppers_coll);
pstmt.setString(29,imp_deffcl);
pstmt.setString(30,imp_bustech);
pstmt.setString(31,imp_legal);
pstmt.setString(32,imp_privcoll);
pstmt.setString(33,imp_defbkre);
pstmt.setString(34,imp_decsupt);
pstmt.setString(35,imp_riskmgt);
pstmt.setString(36,imp_defreo);
pstmt.setString(37,imp_defbknre);
pstmt.setString(38,imp_qualsvc);
pstmt.setString(39,imp_intlctrl);
pstmt.setString(40,imp_defwkfl);
pstmt.setString(41,imp_defwkout);
pstmt.setString(42,imp_trtpi);
pstmt.setString(43,impact_other);
pstmt.setString(44,imp_defmgt);
pstmt.setString(45,imp_deftax);
pstmt.setString(46,imp_vendmgt);
pstmt.setString(47,imp_defctrl);
pstmt.setString(48,imp_defrecre);
pstmt.setString(49,imp_busadm);
pstmt.setString(50,impact_other_specify);
pstmt.setString(51,change_in_kpmg);
pstmt.setString(52,change_in_ots);
pstmt.setString(53,change_in_nfr);
pstmt.setString(54,change_in_arr);
pstmt.setString(55,change_in_brr);
pstmt.setString(56,change_in_proc_imp);
pstmt.setString(57,change_inter_citpol);
pstmt.setString(58,change_in_other);
pstmt.setString(59,change_in_other_specify);
pstmt.setString(60,change_init_details);
pstmt.setString(61,req_info_descript);
pstmt.setString(62,req_info_explain_currbus);
pstmt.setString63,req_info_explain_proposed);
pstmt.setString(64,req_ben_prop_benefit);
pstmt.setString(65,req_ben_fin_implement);
pstmt.setString(66,req_ben_ops_implement);
pstmt.setString(67,projyes);
pstmt.setString(68,vulnass);
pstmt.setString(69,cbachg);
pstmt.setString(70,riskacc);
pstmt.setString(71,marsitem);
pstmt.setString(72,gccrfp);
pstmt.setString(73,applcomp);
pstmt.setString(74,capexpend);
pstmt.executeUpdate();
if anyone sees anything flawed here, please let me know!
Thanks!
Message was edited by:
bpropes20
Message was edited by:
bpropes20
Message was edited by:
bpropes20What a mess. First off, the line pstmt.setInt(1,++lastRowNum); just needs to go away. You're already using a sequence to set the value for the primary keys, you don't need to add a mistake like this.
I then count 73 question marks (you can verify, I'm not counting again.) That would mean that your indices are off by one, and the ArrayIndexOutOfBounds is probably coming from pstmt.setString(74,capexpend); Dump the ++lastRowNum line, change all of your indices (after verifying the bind count!) and try it again.
You can see an inherent weakness in the PreparedStatement clauses - one change means manually rewriting all of the indices. A solution is dumping all of your bind values into a List, then loop through the list to do your setXXX statements. If all binds are not of the same type, you can bind the values to some object that identifies type and use those objects in the list instead of the values. A little more complex, but easier to maintain in my opinion. -
Print out a column value only if another column has a specific value (CASE Statement)
Hello all,
I tried many hours to find a solution for the following request but wasn't successful. Maybe you could help me.
I've using the already existing SQL Views in Microsoft Service Manager to do some basic reporting about my tickets.There is no closed date in the activity tickets so I decided to print out the lastmodified timestamp when the status is "closed".
That's my query:
SELECT DISTINCT
dbo.DisplayStringView.DisplayName AS Status,
CASE WHEN dbo.DisplayStringView.DisplayName = 'Closed' THEN dbo.DisplayStringView.LastModified ELSE 'NO CLOSED Date' END AS ClosedDate
FROM dbo.MTV_System$WorkItem$Activity$ManualActivity LEFT OUTER JOIN
dbo.DisplayStringView ON dbo.MTV_System$WorkItem$Activity$ManualActivity.Status_8895EC8D_2CBF_0D9D_E8EC_524DEFA00014 = dbo.DisplayStringView.LTStringId
Unfortunatelly I'm not getting the value from dbo.DisplayStringView.LastModified. SQL outputs that it is not possible to convert the string to date/time.
I think there is a problem with the CASE statement in combination with a value select.
Any ideas how to print out a column value only if another column has a specific value?I think it is the other way if you want the missing date shown as a string.
CASE
WHEN
dbo.DisplayStringView.DisplayName
=
'Closed'
THEN
Convert( varchar(10),dbo.DisplayStringView.LastModified
, 101) ELSE
'NO CLOSED Date'
END
AS
ClosedDate -
Hi all,
Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
Problem #1) How can I print out or export these 3 dbo Tables?
Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service.
--> Failed to retrieve data for this request. --> Invalid class. Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
to manage a service. --> Failed to retrieve data for this request. --> Invalid class. .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates> What causes this set of error messages? How can
I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
Thanks in advance,
Scott ChangIn the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
2) I don't know why you get that error, but any particular reason you want to run PowerShell?
4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
As for left/right join, notice that these two are equivalent:
SELECT ...
FROM a LEFT JOIN b ON a.col = b.col
SELECT ...
FROM b RIGHT JOIN a ON a.col = b.col
But please never use RIGHT JOIN - it gives me a headache!
There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
Here is an example where you can study the different join types and how they behave:
CREATE TABLE apple (a int NOT NULL PRIMARY KEY,
b varchar(23) NOT NULL)
INSERT apple(a, b)
VALUES(1, 'Granny Smith'),
(2, 'Gloster'),
(4, 'Ingrid-Marie'),
(5, 'Milenga')
CREATE TABLE orange(c int NOT NULL PRIMARY KEY,
d varchar(23) NOT NULL)
INSERT orange(c, d)
VALUES(1, 'Agent'),
(3, 'Netherlands'),
(4, 'Revolution')
SELECT a, b, c, d
FROM apple
CROSS JOIN orange
SELECT a, b, c, d
FROM apple
INNER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
LEFT OUTER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
RIGHT OUTER JOIN orange ON apple.a = orange.c
SELECT a, b, c, d
FROM apple
FULL OUTER JOIN orange ON apple.a = orange.c
go
DROP TABLE apple, orange
Erland Sommarskog, SQL Server MVP, [email protected] -
I'm trying to print out a credit card statement from my iPad, it only prints the first page not the 4 pages, please help
I read your first post when I was posing a separate question on the Mac Pro board. I now see that we may be talking about printing from an iPad with Airprint instead!!!!! I very much suspect the print command and settings are different for Airprint but I have never used it to be able to offer concrete advice. I think the setting choices could be different even with Airprint on the laptop and further that you may not even be using Safari but some special app???
I've not heard or seen the term "frame" in the context of printing before except perhaps in the context of a screen shot. Is the credit card statement a "pop-up" of some kind rather than a webpage or pdf? -
Print out table desc from sql/plus
Hello,
I'm trying to print out the desc table from the database .
What is the syntax for it in the sql/plus ?
Thanks very much.
TPham
nulltpham (guest) wrote:
: Hello,
: I'm trying to print out the desc table from the database .
: What is the syntax for it in the sql/plus ?
: Thanks very much.
: TPham
Jerome wrote:
Hi! Tipham!
Here is the command:
In Sql/plus
1. spool on --these command set spool on
2. spool c:\desc_table.sql -- these command open desc_table.sql
file for spooling. It is
user-defined it will be created if
it is not existin
3. desc table_name -- the result will be recorded to
desc_table file. Open it in any text
editor and print it.
from [email protected]
null -
DIsabling printing of the sql statement in command prompt
Hi.
I am connecting to an access database with my java application. Problem is, it prints the connection and the sql statement there. Is there any way to disable it?
Example of what is seen at my command prompt:
connection is dbc:odbc:Inventory System
DB: SELECT * FROM Products WHERE ProductID = 1;Ah i see where my mistake is now...Gracefully put. Many of the regulars here and in other forums get a little frustrated, either seeing the same basic problems over and over (it's as if Google doesn't work in vast parts of the world) or or the occaisional person who really isn't willing to work or willing to learn - they want "the answer". Sometimes after a bad run of that we get a little sensitive and snarky. Don't feel bad, there's a mountain to learn with JDBC and, personally, I think everyone is entitled to one brain f*rt a week (<snark> although this may count as one-and-a-half </snark>). Good luck.
-
Print out all methods in program with print statements
Does anyone know how I would be able to print out all the methods in a program. For example:
class bd220p1 {
public static void main(String args[]) {
int lightspeedi,lightspeedm;
long days;
long seconds;
long distancei;
long distancem;
// approximate speed of light in miles per second
lightspeedi = 186000;
// approximate speed of light in Kilometers per second
lightspeedm = 300000;
days = 1000; // specify number of days here
seconds = days * 24 * 60 * 60; // convert to seconds
distancem = lightspeedm * seconds; // compute distance in English system
distancei = lightspeedi * seconds;// compute distance in Metric system
System.out.print("In " + days);
System.out.print(" days light will travel about ");
System.out.println(distancei + " miles and");
System.out.print(distancem + " Kilometers ");
}This code would produce 5 print statements for the 4 methods:
1 Main method
2 Print method
3 Print method
4 Println method
5 Print method
Does anyone know I can write the could to accomplish this? Right now I am experimenting with try/catch statements. Any help is greatly appreciated.It seems to me the easiest approaches (other than using a tool someone else has already written) are:
1) Compile the source, and then use BCEL
2) Try some regular expressions; it won't be perfect but maybe you can tweak it until it's good enough.
3) Parse the source, and examine the parse tree.
1 and 3 will give you much better results, but require you to use outside libraries (or write a parser yourself).
You can do 2 using standard stuff from the JDK, but you may spend a lot of trial-and-error gettng the regexps right.
Which you choose will depend a lot on what the prof giving the assignment allows.
Also he may have some particular kind of solution in mind -- did he say anything?
If you're not sure what to do, ask your prof for clarification. -
Pretty printing SQL statements in Java
Hello,
Environment: Oracle 10g (no prepared statements) and WebLogic 10 using WL's connection pooling.
We have dynamically generated SQL in our Java code and currently print the SQL to our (log4j) logger as one long Java String. Does Oracle offer a method call to better format the SQL prior to calling the logger to log the SQL?
Thanks,
JimHi Jim,
Just an idea. Oracle SQLDeveloper has a formatting utillity. Since the IDE is written in Java, there just might be a jar/class that can be used elsewhere.
As said, just an idea. Maybe you can download it and try to investigate yourself.
Best regards
Peter -
Post Author: Fedor
CA Forum: Data Connectivity and SQL
Somebody knows, how can I print the currently SQL statement?Post Author: V361
CA Forum: Data Connectivity and SQL
Go to database, Show SQL Query, highlight the query, RIght Click and select copy, then you can paste that into word, or excel, or text file. An example is pasted below.
SELECT `Customer`.`Region`, `Customer`.`City`, `Customer`.`Address2`, `Customer`.`Address1`, `Customer`.`Customer Name`, `Customer`.`Postal Code`, `Customer`.`Country` FROM `Customer` `Customer` -
Need to take Print out - PL SQL Program / Unix
Hi,
I need to take print out from a file already created in Database Server in a specific path to a printer. Any PL SQL program or any shell script is there to do this??
Thanks,
NeilNeil_80 wrote:
I need to take print out from a file already created in Database Server in a specific path to a printer. Any PL SQL program or any shell script is there to do this??Not enough information.
{message:id=9360002}
It's perfectly possible, but will depend on where your data is and whether it's already a printer output file etc.
e.g. you could use the dbms_scheduler package to call a command line that sends the file directly to the printer device
However, the specifics of that will depend on your database version and your operating system, and what file you're trying to send. -
I use printopia to print from my iPad, trying to print out a 4 page credit card statement, but it only prints out the first page, please help
What version of iOS are you using? Some people were having this problem before, and it was fixed when they updated to iOS 5.
-
Balance sheet statement Print out
Dear all,
I would like to print out a balance sheet report through transaction code S_ALR_87012284. But I would like to assign another form (smartform) to this transaction instead of print out ABAP List. (It means the screen display ABAP List but print out via smartform). What should I do now ? Is there any transaction code for assigning a print form to a transaction instead of ABAP coding ?
Thank you very much for your help.
SylvecatDear,
If I understood your requirement correctly then you want different ZERO balance clearing GL Account for below type GL Accounts
xxxx00 accounts for all accounting principles
xxxx01 accounts for US GAAP
xxxx02 accounts for IAS
xxxx03 accounts for local GAAP
Please correct me if I am wrong. If correct then you can post accounting entries to different GL Account by using Substitution OBBH. You have to decide the pre-requisite and on the basis of that you can write the substituon.
Hope this helps.
Br,Vivek -
My Account Activity page for my checking account has an eight column listing ie: date, type, description, debit, credit, balance, etc.
Only the first five columns print out regardless of how much I scale the printing size down. It prints out fully and correctly when I use Internet Explorer browser to view the bank website.I've encountered a similar problem with HTML email sent from Outlook once before. I had to manually edit the HTML file and then display it in my browser and it printed fine. I don't recall the exact problem, but it had something to do with malformed HTML tags. Whatever they used to generate the HTML document, it was putting in bad tags at the ends of lines (like to force a line wrap) and when printed, this would instead function as a cutoff of the right side of the text. (the HTML parser in FF - in my case Thunderbird, would simply ignore everything after these bad tags, as it probably should)
If you don't know about HTML find someone who does that you trust to look at the document and manually edit it for you. Someone familiar with basic HTML should be able to spot and fix the problem in about 5 minutes. Short of that, see if your bank can send them via email in PDF instead, but regardless be sure to inform them their documents are not created properly. The problem is most likely on their end, not yours, and not with FF.
EDIT-------------
Just remembered something.
There are two add-ons you might be interested in:
IETab - it uses the Trident web engine to display the web page. (what IE uses) It should essentially work just like IE, but from within FF.
User Agent Switcher - I use this more frequently as all it does is tell the webserver that I am using IE and not FF. (even though I am using FF) and voila! I get the page delivered correctly with all intended functionality. (Odd, I know - chalk it up to lazy and ignorant web developers)
Both may be of use to you, the second is more secure, and either should be a work around to solve your problem that won't involve editing or knowing HTML. -
Extracting SQL statement from a Webi document's data provider using SDK.
Hi all,
Is it possible to extract the SQL statement from an existing Webi document's data provider using BO SDK? I've searched through the class library but haven't found any information on this yet. If you have done it, could you provide some guidance. Many thanks.I found the following Java code that might be of some help to you. I realize you are using .NET but this might push you down the right path.
The trick here is to use the Report Engine SDK to get the DataProvider of the DocumentInstance. Then, look at the SQLDataProvider to get your SQLContainer.
My apologies for the poor formatting. This didn't copy and paste over to the forums very well. I've cleaned up as much as I could.
<%@ page import="com.crystaldecisions.sdk.framework.*" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>
<%@ page import="com.businessobjects.rebean.wi.*" %>
<%
boolean loginSuccessful = false;
IEnterpriseSession oEnterpriseSession = null;
String username = "username";
String password = "password";
String cmsname = "cms_name";
String authenticationType = "secEnterprise";
try
//Log in. oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsname, authenticationType);
if (oEnterpriseSession == null)
out.print("<FONT COLOR=RED><B>Unable to login.</B></FONT>");
else
{ loginSuccessful = true;
catch (SDKException sdkEx)
{ out.print("<FONT COLOR=RED><B>ERROR ENCOUNTERED</B><BR>" + sdkEx + "</FONT>");}
if (loginSuccessful) { IInfoObject oInfoObject = null;
String docname = "WebI document name";
//Grab the InfoStore from the httpsession IInfoStore oInfoStore = (IInfoStore) oEnterpriseSession.getService("", "InfoStore"); //Query for the report object in the CMS. See the Developer Reference guide for more information the query language. String query = "SELECT TOP 1 * " + "FROM CI_INFOOBJECTS " + "WHERE SI_INSTANCE = 0 And SI_Kind = 'Webi' " + "AND SI_NAME='" + docname + "'";
IInfoObjects oInfoObjects = (IInfoObjects) oInfoStore.query(query);
if (oInfoObjects.size() > 0)
//Retrieve the latest instance of the report oInfoObject = (IInfoObject) oInfoObjects.get(0);
// Initialize the Report Engine ReportEngines oReportEngines = (ReportEngines)
oEnterpriseSession.getService("ReportEngines");
ReportEngine oReportEngine = (ReportEngine) oReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
// Openning the document DocumentInstance oDocumentInstance = oReportEngine.openDocument(oInfoObject.getID());
DataProvider oDataProvider = null;
SQLDataProvider oSQLDataProvider = null;
SQLContainer oSQLContainer_root = null;
SQLNode oSQLNode = null;
SQLSelectStatement oSQLSelectStatement = null;
String sqlStatement = null;
out.print("<TABLE BORDER=1>");
for (int i=0; i<oDocumentInstance.getDataProviders().getCount(); i++)
oDataProvider = oDocumentInstance.getDataProviders().getItem(i);
out.print("<TR><TD COLSPAN=2 BGCOLOR=KHAKI>Data Provider Name: " + oDataProvider.getName() + "</TD></TR>");
if (oDataProvider instanceof SQLDataProvider)
oSQLDataProvider = (SQLDataProvider) oDataProvider;
oSQLContainer_root = oSQLDataProvider.getSQLContainer();
if (oSQLContainer_root != null)
for (int j=0; j<oSQLContainer_root.getChildCount(); j++)
oSQLNode = (SQLNode) oSQLContainer_root.getChildAt(j);
oSQLSelectStatement = (SQLSelectStatement) oSQLNode;
sqlStatement = oSQLSelectStatement.getSQL();
out.print("<TR><TD>" + (j+1) + "</TD><TD>" + sqlStatement + "</TD></TR>");
else
out.print("<TR><TD COLSPAN=2>Data Provider is not a SQLDataProvider. SQL Statement can not be retrieved.</TD></TR>"); } } out.print("</TABLE>");
oDocumentInstance.closeDocument(); }
oEnterpriseSession.logoff();}%>
Maybe you are looking for
-
File adapter mapping - parser: no data allowed here
Hello, something really nice: Scenario picks up a file to move it renamed with timestamp to another destination via FTP protocoll. File picked up: ok But in pipeline: Message in trace: <Trace level="1" type="T">RuntimeException during appliction Java
-
Problems in displaying chinese characters with utf-8 encoding
Hi, I got problem in displaying chinese characters in my web application. I am creating a web application supporting both English and Chinese charaters. What I am trying to do is: 1. storing some chinese characters via a web page (page1) into databas
-
I have an ipod touch that i use for my music in itunes, my question is can i restore an older nano 3rd generation ipod and use it for podcasts only, from the same account that i use for the itouch...sorry if this doesnt make sence! I want to use two
-
RE - up grading to MacOSX 10.7
While waiting for new generation of MacPro I operated happily on a 2006 MacPro maxed out with RAM and videocards and internal raid ... . Eventually my setup felt sloggish with FCPX and this year I got a maxed out iMac ( 2011 TB - 3.4 - 2GB video ). A
-
BB gone very slow ...help please
I live in a rural area, am about 3 miles from the exchange, so I'm used to not having a fast service, however my speed often runs around 1.22Mb/s download and 0.38Mb/s upload. But yesterday it dropped to very slow. I just decided to leave it for 24 h