Querying an Oracle Database Using XSL
I know from years of experience as an Oracle DBA that to suggest that a program generate SQL is anathema, but I'm going to ask anyway!
Is there currently (or soon) to be a means of submitting XSL (or, perhaps, some variant based on the most recently published "standard") to an Oracle database and receiving an XML result set?
Note that I have not mentioned writing any SQL myself. I'm either looking for some middleware to translate the XSL "query" into the appropriate SQL query (with appropriate after-query transformations) or for the database engine itself to be able to parse and optimize XSL.
I just read a position paper (dated 1998) on this site that says that Oracle intends to closely follow developments in the world of XML Query. And, I've read in a "Byte" article ("Where Are The XML Apps We Can See And Touch? Report From XML DevCon 2001", April 2001, Jon Udell) that Steve Muench had demonstrated some means of super-imposing an XML schema over top of a database in order to query it via XPath. Where does the product stand in regards to this type of functionality?
Thanks in advance,
David Park
[email protected]
For your reference:
1/XML SQL Utility(XSU) in XDK for Java (also with PL/SQL API)
http://technet.oracle.com/tech/xml/xdk_java
- The XSU can transform data retreived from object-relational database tables or views into XML.
- The XSU can extract data from a XML document and using a canonical mapping, insert the data into the appropriate columns/attributes of a table or a view.
- The XSU can extract data from a XML document and apply this data to updating or deleteing values of the appropriate columns/attributes.
2/ The documents for XMLType and DBUri(available in Oracle9i).
http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/appdev.901/a88894/adx05xml.htm#1012692
3/ Oracle Text also have XPATH-based search.
http://otn.oracle.com/docs/products/oracle9i/doc_library/901_doc/text.901/a90122/csectio4.htm#33034
Similar Messages
-
Problem querying an Oracle Database using PHP
Hi there, im rather new to Oracle so pardon my ignorance if this is completely obvious but I am creating a web form that queries an oracle database, firstly is a user form which looks like this.
<br><br>
Search for Investments<br>
<form action="query.php" method="POST"><br>
<input type = "text" name = "invest"><br>
<input type="submit" value="Search" name="submit" /><br>
</form><br>
-----------------------<br><br>
and the php script which looks like this<br><br>
-----------------------<br><br>
<?php<br><
print "<HTML><PRE>";<br><br>
require_once('connect.php');<br>
select_data($conn);<br><br>
$invest = $_POST['invest'];<br>
echo "Returning results related to $invest";<br><br>
function select_data($conn)<br>
{ $stmt = ociparse($conn,"select * from investmentbase where INVTYPE='$invest'");<br>
ociexecute($stmt,OCI_DEFAULT);<br><br>
echo "<table border = 1 class=results>";<br><br>
echo "<tr>";<br>
echo "<td>Reference Number</td>";<br>
echo "<td>User ID</td>";<br>
echo "<td>Investment Type</td>";<br>
echo "<td>Investment Description</td>";<br>
echo "<td>Amount Required</td>";<br>
echo "<td>Due Date<td>";<br>
echo "</tr>";<br><br>
while (ocifetch($stmt)){<br>
echo "<tr>";<br>
echo "<td>";<br>
echo ociresult($stmt,"INVREF")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"USERID")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"INVTYPE")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"INVDESCRIPTION")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"AMOUNTREQUIRED")." ";<br>
echo "</td>";<br>
echo "<td>";<br>
echo ociresult($stmt,"REQUIREDATE");<br>
echo "</td>";<br>
echo "</tr>";<br><br>
}<br>
echo "</table>";<br>
}<br><br>
ocilogoff($conn);<br>
print "</PRE></HTML>";<br>
?> <br><br>
When i search for a value that is in the database no results are returned, however the form is definitely posting the variable as the echo statement on the PHP script displays it. Any ideas would be gratefully appreciated
Many Thanks
PaulDo you need to set $invest before calling do_select() and pass it as a
parameter? Also, watch out for SQL Injection security risks. Try
using a bind variable.
$invest = $_POST['invest'];
echo "Returning results related to $invest";
select_data($conn, $invest);
function select_data($conn, $invest)
$stmt = ociparse($conn,"select * from investmentbase where INVTYPE=:ibv");
ocibindbyname($stmt, ':ibv', $invest);
ociexecute($stmt,OCI_DEFAULT);
. . .Although the PHP 4 naming style for oci8 functions can be used with
PHP 5, I know there is a possibility you are using the PHP 4 OCI8
extension. If you are, then upgrade at least OCI8. There are some
notes on this in
Re: frustrations with oci_fetch_array()
-- cj -
Query in timesten taking more time than query in oracle database
Hi,
Can anyone please explain me why query in timesten taking more time
than query in oracle database.
I am mentioning in detail what are my settings and what have I done
step by step.........
1.This is the table I created in Oracle datababase
(Oracle Database 10g Enterprise Edition Release 10.2.0.1.0)...
CREATE TABLE student (
id NUMBER(9) primary keY ,
first_name VARCHAR2(10),
last_name VARCHAR2(10)
2.THIS IS THE ANONYMOUS BLOCK I USE TO
POPULATE THE STUDENT TABLE(TOTAL 2599999 ROWS)...
declare
firstname varchar2(12);
lastname varchar2(12);
catt number(9);
begin
for cntr in 1..2599999 loop
firstname:=(cntr+8)||'f';
lastname:=(cntr+2)||'l';
if cntr like '%9999' then
dbms_output.put_line(cntr);
end if;
insert into student values(cntr,firstname, lastname);
end loop;
end;
3. MY DSN IS SET THE FOLLWING WAY..
DATA STORE PATH- G:\dipesh3repo\db
LOG DIRECTORY- G:\dipesh3repo\log
PERM DATA SIZE-1000
TEMP DATA SIZE-1000
MY TIMESTEN VERSION-
C:\Documents and Settings\dipesh>ttversion
TimesTen Release 7.0.3.0.0 (32 bit NT) (tt70_32:17000) 2007-09-19T16:04:16Z
Instance admin: dipesh
Instance home directory: G:\TimestTen\TT70_32
Daemon home directory: G:\TimestTen\TT70_32\srv\info
THEN I CONNECT TO THE TIMESTEN DATABASE
C:\Documents and Settings\dipesh> ttisql
command>connect "dsn=dipesh3;oraclepwd=tiger";
4. THEN I START THE AGENT
call ttCacheUidPwdSet('SCOTT','TIGER');
Command> CALL ttCacheStart();
5.THEN I CREATE THE READ ONLY CACHE GROUP AND LOAD IT
create readonly cache group rc_student autorefresh
interval 5 seconds from student
(id int not null primary key, first_name varchar2(10), last_name varchar2(10));
load cache group rc_student commit every 100 rows;
6.NOW I CAN ACCESS THE TABLES FROM TIMESTEN AND PERFORM THE QUERY
I SET THE TIMING..
command>TIMING 1;
consider this query now..
Command> select * from student where first_name='2155666f';
< 2155658, 2155666f, 2155660l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.668822 seconds.
another query-
Command> SELECT * FROM STUDENTS WHERE FIRST_NAME='2340009f';
2206: Table SCOTT.STUDENTS not found
Execution time (SQLPrepare) = 0.074964 seconds.
The command failed.
Command> SELECT * FROM STUDENT where first_name='2093434f';
< 2093426, 2093434f, 2093428l >
1 row found.
Execution time (SQLExecute + Fetch Loop) = 0.585897 seconds.
Command>
7.NOW I PERFORM THE SIMILAR QUERIES FROM SQLPLUS...
SQL> SELECT * FROM STUDENT WHERE FIRST_NAME='1498671f';
ID FIRST_NAME LAST_NAME
1498663 1498671f 1498665l
Elapsed: 00:00:00.15
Can anyone please explain me why query in timesten taking more time
that query in oracle database.
Message was edited by: Dipesh Majumdar
user542575
Message was edited by:
user542575TimesTen
Hardware: Windows Server 2003 R2 Enterprise x64; 8 x Dual-core AMD 8216 2.41GHz processors; 32 GB RAM
Version: 7.0.4.0.0 64 bit
Schema:
create usermanaged cache group factCache from
MV_US_DATAMART
ORDER_DATE DATE,
IF_SYSTEM VARCHAR2(32) NOT NULL,
GROUPING_ID TT_BIGINT,
TIME_DIM_ID TT_INTEGER NOT NULL,
BUSINESS_DIM_ID TT_INTEGER NOT NULL,
ACCOUNT_DIM_ID TT_INTEGER NOT NULL,
ORDERTYPE_DIM_ID TT_INTEGER NOT NULL,
INSTR_DIM_ID TT_INTEGER NOT NULL,
EXECUTION_DIM_ID TT_INTEGER NOT NULL,
EXEC_EXCHANGE_DIM_ID TT_INTEGER NOT NULL,
NO_ORDERS TT_BIGINT,
FILLED_QUANTITY TT_BIGINT,
CNT_FILLED_QUANTITY TT_BIGINT,
QUANTITY TT_BIGINT,
CNT_QUANTITY TT_BIGINT,
COMMISSION BINARY_FLOAT,
CNT_COMMISSION TT_BIGINT,
FILLS_NUMBER TT_BIGINT,
CNT_FILLS_NUMBER TT_BIGINT,
AGGRESSIVE_FILLS TT_BIGINT,
CNT_AGGRESSIVE_FILLS TT_BIGINT,
NOTIONAL BINARY_FLOAT,
CNT_NOTIONAL TT_BIGINT,
TOTAL_PRICE BINARY_FLOAT,
CNT_TOTAL_PRICE TT_BIGINT,
CANCELLED_ORDERS_COUNT TT_BIGINT,
CNT_CANCELLED_ORDERS_COUNT TT_BIGINT,
ROUTED_ORDERS_NO TT_BIGINT,
CNT_ROUTED_ORDERS_NO TT_BIGINT,
ROUTED_LIQUIDITY_QTY TT_BIGINT,
CNT_ROUTED_LIQUIDITY_QTY TT_BIGINT,
REMOVED_LIQUIDITY_QTY TT_BIGINT,
CNT_REMOVED_LIQUIDITY_QTY TT_BIGINT,
ADDED_LIQUIDITY_QTY TT_BIGINT,
CNT_ADDED_LIQUIDITY_QTY TT_BIGINT,
AGENT_CHARGES BINARY_FLOAT,
CNT_AGENT_CHARGES TT_BIGINT,
CLEARING_CHARGES BINARY_FLOAT,
CNT_CLEARING_CHARGES TT_BIGINT,
EXECUTION_CHARGES BINARY_FLOAT,
CNT_EXECUTION_CHARGES TT_BIGINT,
TRANSACTION_CHARGES BINARY_FLOAT,
CNT_TRANSACTION_CHARGES TT_BIGINT,
ORDER_MANAGEMENT BINARY_FLOAT,
CNT_ORDER_MANAGEMENT TT_BIGINT,
SETTLEMENT_CHARGES BINARY_FLOAT,
CNT_SETTLEMENT_CHARGES TT_BIGINT,
RECOVERED_AGENT BINARY_FLOAT,
CNT_RECOVERED_AGENT TT_BIGINT,
RECOVERED_CLEARING BINARY_FLOAT,
CNT_RECOVERED_CLEARING TT_BIGINT,
RECOVERED_EXECUTION BINARY_FLOAT,
CNT_RECOVERED_EXECUTION TT_BIGINT,
RECOVERED_TRANSACTION BINARY_FLOAT,
CNT_RECOVERED_TRANSACTION TT_BIGINT,
RECOVERED_ORD_MGT BINARY_FLOAT,
CNT_RECOVERED_ORD_MGT TT_BIGINT,
RECOVERED_SETTLEMENT BINARY_FLOAT,
CNT_RECOVERED_SETTLEMENT TT_BIGINT,
CLIENT_AGENT BINARY_FLOAT,
CNT_CLIENT_AGENT TT_BIGINT,
CLIENT_ORDER_MGT BINARY_FLOAT,
CNT_CLIENT_ORDER_MGT TT_BIGINT,
CLIENT_EXEC BINARY_FLOAT,
CNT_CLIENT_EXEC TT_BIGINT,
CLIENT_TRANS BINARY_FLOAT,
CNT_CLIENT_TRANS TT_BIGINT,
CLIENT_CLEARING BINARY_FLOAT,
CNT_CLIENT_CLEARING TT_BIGINT,
CLIENT_SETTLE BINARY_FLOAT,
CNT_CLIENT_SETTLE TT_BIGINT,
CHARGEABLE_TAXES BINARY_FLOAT,
CNT_CHARGEABLE_TAXES TT_BIGINT,
VENDOR_CHARGE BINARY_FLOAT,
CNT_VENDOR_CHARGE TT_BIGINT,
ROUTING_CHARGES BINARY_FLOAT,
CNT_ROUTING_CHARGES TT_BIGINT,
RECOVERED_ROUTING BINARY_FLOAT,
CNT_RECOVERED_ROUTING TT_BIGINT,
CLIENT_ROUTING BINARY_FLOAT,
CNT_CLIENT_ROUTING TT_BIGINT,
TICKET_CHARGES BINARY_FLOAT,
CNT_TICKET_CHARGES TT_BIGINT,
RECOVERED_TICKET_CHARGES BINARY_FLOAT,
CNT_RECOVERED_TICKET_CHARGES TT_BIGINT,
PRIMARY KEY(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID, INSTR_DIM_ID, EXECUTION_DIM_ID,EXEC_EXCHANGE_DIM_ID),
READONLY);
No of rows: 2228558
Config:
< CkptFrequency, 600 >
< CkptLogVolume, 0 >
< CkptRate, 0 >
< ConnectionCharacterSet, US7ASCII >
< ConnectionName, tt_us_dma >
< Connections, 64 >
< DataBaseCharacterSet, AL32UTF8 >
< DataStore, e:\andrew\datacache\usDMA >
< DurableCommits, 0 >
< GroupRestrict, <NULL> >
< LockLevel, 0 >
< LockWait, 10 >
< LogBuffSize, 65536 >
< LogDir, e:\andrew\datacache\ >
< LogFileSize, 64 >
< LogFlushMethod, 1 >
< LogPurge, 0 >
< Logging, 1 >
< MemoryLock, 0 >
< NLS_LENGTH_SEMANTICS, BYTE >
< NLS_NCHAR_CONV_EXCP, 0 >
< NLS_SORT, BINARY >
< OracleID, NYCATP1 >
< PassThrough, 0 >
< PermSize, 4000 >
< PermWarnThreshold, 90 >
< PrivateCommands, 0 >
< Preallocate, 0 >
< QueryThreshold, 0 >
< RACCallback, 0 >
< SQLQueryTimeout, 0 >
< TempSize, 514 >
< TempWarnThreshold, 90 >
< Temporary, 1 >
< TransparentLoad, 0 >
< TypeMode, 0 >
< UID, OS_OWNER >
ORACLE:
Hardware: Sunos 5.10; 24x1.8Ghz (unsure of type); 82 GB RAM
Version 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
Schema:
CREATE MATERIALIZED VIEW OS_OWNER.MV_US_DATAMART
TABLESPACE TS_OS
PARTITION BY RANGE (ORDER_DATE)
PARTITION MV_US_DATAMART_MINVAL VALUES LESS THAN (TO_DATE(' 2007-11-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D1 VALUES LESS THAN (TO_DATE(' 2007-11-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D2 VALUES LESS THAN (TO_DATE(' 2007-11-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_NOV_D3 VALUES LESS THAN (TO_DATE(' 2007-12-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D1 VALUES LESS THAN (TO_DATE(' 2007-12-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D2 VALUES LESS THAN (TO_DATE(' 2007-12-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_07_DEC_D3 VALUES LESS THAN (TO_DATE(' 2008-01-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D1 VALUES LESS THAN (TO_DATE(' 2008-01-11 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D2 VALUES LESS THAN (TO_DATE(' 2008-01-21 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_08_JAN_D3 VALUES LESS THAN (TO_DATE(' 2008-02-01 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
LOGGING
NOCOMPRESS
TABLESPACE TS_OS,
PARTITION MV_US_DATAMART_MAXVAL VALUES LESS THAN (MAXVALUE)
LOGGING
NOCOMPRESS
TABLESPACE TS_OS
NOCACHE
NOCOMPRESS
NOPARALLEL
BUILD DEFERRED
USING INDEX
TABLESPACE TS_OS_INDEX
REFRESH FAST ON DEMAND
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT order_date, if_system,
GROUPING_ID (order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id
) GROUPING_ID,
/* ============ DIMENSIONS ============ */
time_dim_id, business_dim_id, account_dim_id, ordertype_dim_id,
instr_dim_id, execution_dim_id, exec_exchange_dim_id,
/* ============ MEASURES ============ */
-- o.FX_RATE /* FX_RATE */,
COUNT (*) no_orders,
-- SUM(NO_ORDERS) NO_ORDERS,
-- COUNT(NO_ORDERS) CNT_NO_ORDERS,
SUM (filled_quantity) filled_quantity,
COUNT (filled_quantity) cnt_filled_quantity, SUM (quantity) quantity,
COUNT (quantity) cnt_quantity, SUM (commission) commission,
COUNT (commission) cnt_commission, SUM (fills_number) fills_number,
COUNT (fills_number) cnt_fills_number,
SUM (aggressive_fills) aggressive_fills,
COUNT (aggressive_fills) cnt_aggressive_fills,
SUM (fx_rate * filled_quantity * average_price) notional,
COUNT (fx_rate * filled_quantity * average_price) cnt_notional,
SUM (fx_rate * fills_number * average_price) total_price,
COUNT (fx_rate * fills_number * average_price) cnt_total_price,
SUM (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END) cancelled_orders_count,
COUNT (CASE
WHEN order_status = 'C'
THEN 1
ELSE 0
END
) cnt_cancelled_orders_count,
-- SUM(t.FX_RATE*t.NO_FILLS*t.AVG_PRICE) AVERAGE_PRICE,
-- SUM(FILLS_NUMBER*AVERAGE_PRICE) STAGING_AVERAGE_PRICE,
-- COUNT(FILLS_NUMBER*AVERAGE_PRICE) CNT_STAGING_AVERAGE_PRICE,
SUM (routed_orders_no) routed_orders_no,
COUNT (routed_orders_no) cnt_routed_orders_no,
SUM (routed_liquidity_qty) routed_liquidity_qty,
COUNT (routed_liquidity_qty) cnt_routed_liquidity_qty,
SUM (removed_liquidity_qty) removed_liquidity_qty,
COUNT (removed_liquidity_qty) cnt_removed_liquidity_qty,
SUM (added_liquidity_qty) added_liquidity_qty,
COUNT (added_liquidity_qty) cnt_added_liquidity_qty,
SUM (agent_charges) agent_charges,
COUNT (agent_charges) cnt_agent_charges,
SUM (clearing_charges) clearing_charges,
COUNT (clearing_charges) cnt_clearing_charges,
SUM (execution_charges) execution_charges,
COUNT (execution_charges) cnt_execution_charges,
SUM (transaction_charges) transaction_charges,
COUNT (transaction_charges) cnt_transaction_charges,
SUM (order_management) order_management,
COUNT (order_management) cnt_order_management,
SUM (settlement_charges) settlement_charges,
COUNT (settlement_charges) cnt_settlement_charges,
SUM (recovered_agent) recovered_agent,
COUNT (recovered_agent) cnt_recovered_agent,
SUM (recovered_clearing) recovered_clearing,
COUNT (recovered_clearing) cnt_recovered_clearing,
SUM (recovered_execution) recovered_execution,
COUNT (recovered_execution) cnt_recovered_execution,
SUM (recovered_transaction) recovered_transaction,
COUNT (recovered_transaction) cnt_recovered_transaction,
SUM (recovered_ord_mgt) recovered_ord_mgt,
COUNT (recovered_ord_mgt) cnt_recovered_ord_mgt,
SUM (recovered_settlement) recovered_settlement,
COUNT (recovered_settlement) cnt_recovered_settlement,
SUM (client_agent) client_agent,
COUNT (client_agent) cnt_client_agent,
SUM (client_order_mgt) client_order_mgt,
COUNT (client_order_mgt) cnt_client_order_mgt,
SUM (client_exec) client_exec, COUNT (client_exec) cnt_client_exec,
SUM (client_trans) client_trans,
COUNT (client_trans) cnt_client_trans,
SUM (client_clearing) client_clearing,
COUNT (client_clearing) cnt_client_clearing,
SUM (client_settle) client_settle,
COUNT (client_settle) cnt_client_settle,
SUM (chargeable_taxes) chargeable_taxes,
COUNT (chargeable_taxes) cnt_chargeable_taxes,
SUM (vendor_charge) vendor_charge,
COUNT (vendor_charge) cnt_vendor_charge,
SUM (routing_charges) routing_charges,
COUNT (routing_charges) cnt_routing_charges,
SUM (recovered_routing) recovered_routing,
COUNT (recovered_routing) cnt_recovered_routing,
SUM (client_routing) client_routing,
COUNT (client_routing) cnt_client_routing,
SUM (ticket_charges) ticket_charges,
COUNT (ticket_charges) cnt_ticket_charges,
SUM (recovered_ticket_charges) recovered_ticket_charges,
COUNT (recovered_ticket_charges) cnt_recovered_ticket_charges
FROM us_datamart_raw
GROUP BY order_date,
if_system,
business_dim_id,
time_dim_id,
account_dim_id,
ordertype_dim_id,
instr_dim_id,
execution_dim_id,
exec_exchange_dim_id;
-- Note: Index I_SNAP$_MV_US_DATAMART will be created automatically
-- by Oracle with the associated materialized view.
CREATE UNIQUE INDEX OS_OWNER.MV_US_DATAMART_UDX ON OS_OWNER.MV_US_DATAMART
(ORDER_DATE, TIME_DIM_ID, BUSINESS_DIM_ID, ACCOUNT_DIM_ID, ORDERTYPE_DIM_ID,
INSTR_DIM_ID, EXECUTION_DIM_ID, EXEC_EXCHANGE_DIM_ID)
NOLOGGING
NOPARALLEL
COMPRESS 7;
No of rows: 2228558
The query (taken Mondrian) I run against each of them is:
select sum("MV_US_DATAMART"."NOTIONAL") as "m0"
--, sum("MV_US_DATAMART"."FILLED_QUANTITY") as "m1"
--, sum("MV_US_DATAMART"."AGENT_CHARGES") as "m2"
--, sum("MV_US_DATAMART"."CLEARING_CHARGES") as "m3"
--, sum("MV_US_DATAMART"."EXECUTION_CHARGES") as "m4"
--, sum("MV_US_DATAMART"."TRANSACTION_CHARGES") as "m5"
--, sum("MV_US_DATAMART"."ROUTING_CHARGES") as "m6"
--, sum("MV_US_DATAMART"."ORDER_MANAGEMENT") as "m7"
--, sum("MV_US_DATAMART"."SETTLEMENT_CHARGES") as "m8"
--, sum("MV_US_DATAMART"."COMMISSION") as "m9"
--, sum("MV_US_DATAMART"."RECOVERED_AGENT") as "m10"
--, sum("MV_US_DATAMART"."RECOVERED_CLEARING") as "m11"
--,sum("MV_US_DATAMART"."RECOVERED_EXECUTION") as "m12"
--,sum("MV_US_DATAMART"."RECOVERED_TRANSACTION") as "m13"
--, sum("MV_US_DATAMART"."RECOVERED_ROUTING") as "m14"
--, sum("MV_US_DATAMART"."RECOVERED_ORD_MGT") as "m15"
--, sum("MV_US_DATAMART"."RECOVERED_SETTLEMENT") as "m16"
--, sum("MV_US_DATAMART"."RECOVERED_TICKET_CHARGES") as "m17"
--,sum("MV_US_DATAMART"."TICKET_CHARGES") as "m18"
--, sum("MV_US_DATAMART"."VENDOR_CHARGE") as "m19"
from "OS_OWNER"."MV_US_DATAMART" "MV_US_DATAMART"
where I uncomment a column at a time and rerun. I improved the TimesTen results since my first post, by retyping the NUMBER columns to BINARY_FLOAT. The results I got were:
No Columns ORACLE TimesTen
1 1.05 0.94
2 1.07 1.47
3 2.04 1.8
4 2.06 2.08
5 2.09 2.4
6 3.01 2.67
7 4.02 3.06
8 4.03 3.37
9 4.04 3.62
10 4.06 4.02
11 4.08 4.31
12 4.09 4.61
13 5.01 4.76
14 5.02 5.06
15 5.04 5.25
16 5.05 5.48
17 5.08 5.84
18 6 6.21
19 6.02 6.34
20 6.04 6.75 -
Unable to connect to Oracle Database using Oracle Sql developer 2.1.1.64
Hi Everyone,
I am searching for some help regarding my problem with Oracle connectivity. I have installed Oracle 11g release 2 on my Windows XP Professional Laptop. For a few days after installation i could connect to the Oracle database with the SYSTEM account using Oracle SQL developer ( installed on the same Laptop) but now i am unable to do so.It gives me this annoying message:
An error was encountered performing the required operation Got a minus one from read call .Vendor code 0
However i am able to connect using Sql Plus by supplying the username SYSTEM and the corresponding password.
My TNSNAMES .ora file is as follows:
ORACLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORACLE)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
My Listener.ora file is as follows:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\product\11.2.0\dbhome_1\bin\oraclr11.dll")
(SID_DESC =
(GLOBAL_DBNAME = Oracle)
(ORACLE_HOME = D:\app\product\11.2.0\dbhome_1)
(SID_NAME = Oracle)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
ADR_BASE_LISTENER = D:\app
My Sqlnet.ora file is as follows:
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
I am new to Oracle and so i need someone in this forum who can help me resolve this problem. Also i even tried connecting to the database using Toad 10.5.0.41. It give me the following error:
ORA 12537 : TNS Connection closed
Thanks for your patience and help in advance.
---PrashantHello Irian and Sue,
I can connect to the Oracle database using SQL Plus. Now when i TNSPING ORACLE from command line i get the following message :
Used parameter files:
D:\app\product\11.2.0\dbhome_1\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =localhost
*)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ORACLE)))*
TNS-12537: TNS:connection closed
Thanks for your response to my initial post.Do u have any other methods to resolve this? -
How To Store pdf or doc file in Oracle Database using Java Jdbc?
can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.
Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
for Adding PDF in DB i used image.jsp
Database table structure (table name. pictures )
Name Null? Type
ID NOT NULL NUMBER(11)
IMAGE BLOB
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
File file =
new File("D:/info.pdf");
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,4);
ps.setBinaryStream(2,fs,fs.available());
int i = ps.executeUpdate();
if(i!=0){
out.println("<h2>PDF inserted successfully");
else{
out.println("<h2>Problem in image insertion");
catch(Exception e){
out.println("<h2>Failed Due To "+e);
%>
O/P: PDF inserted successfully
i tried to display that pdf using servlet. i am giving the code below.
import java.io.IOException;
import java.sql.*;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DispPDF extends HttpServlet {
* The doGet method of the servlet. <br>
* This method is called when a form has its tag value method equals to get.
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.setContentType("text/html"); i commented. coz we cant use response two times.
//PrintWriter out = response.getWriter();
try{
InputStream sPdf;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
ResultSet rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
//out.println(bytearray);
int size=0;
sPdf = rs.getBinaryStream(1);
response.reset();
response.setContentType("application/pdf");
while((size=sPdf.read(bytearray))!= -1 ){
//out.println(size);
response.getOutputStream().write(bytearray,0,size);
catch(Exception e){
System.out.println("Failed Due To "+e);
//out.println("<h2>Failed Due To "+e);
//out.close();
OP
PDF-1.4 %âãÏÓ 2 0 obj <>stream x+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2KüsSSS4C²ê Pkø$VãGÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
plz help me out. -
Connecting to an Oracle database using ASP
Hi
I am having problems connecting to an Oracle database using ASP. I am trying to do this for a school project the school's database server is running Oracle 9i. The repository is version 6. The web server I have access to only has ASP not ASP.net. What kind of connection string would I need to be able to connect to the database?You do need to ensure that the Oracle client and Oracle server are compatible, but that is generally pretty easy to accomplish. Unless you are trying to cross more than one major release (i.e. 9.2 client to a 7.3.4 database), you're pretty safe there.
You could try downloading and installing the latest 8.1.7.x Oracle ODBC driver from OTN on the machine with the 8.1.7 Oracle client (I believe the last ODBC patchset was 8.1.7.10), but I don't have particular confidence that that will solve the problem. If it doesn't, we can do an ODBC trace to focus in on the issue, but installing a new driver is a much easier process, so that probably ought to be the first step.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Issue of inserting greek characters into Oracle database using ICAN505
Hi All,
We are currently facing an issue of inserting greek characters into Oracle database using ICAN505.
We receive a file containing greek characters.The values from the file should be inserted into the database.We are reading the file using file OTD with default encoding.
The file can contain english characters too other than greek characters.
The database NLS_CHARACTERSET is AL32UTF8.
When I insert using an insert statement directly ,the values get inserted properly into the DB table.
Inserting the same values using code results in improper characters getting inserted into the table in the database.
Please help....
Thanks in advance !!Globalization forum?
Globalization Support
It works for SQL Developer, which does not depend on NLS_LANG, so I suspect a problem with your NLS settings. -
NCHAR issue with oracle database using JDBC adapter
Hi,
We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into oracle table fields of type NCHAR/NVARCHAR, we are getting the following error message in the JDBC adapter audit log. IF we pass the numeric value to the same field, then we are able to insert the records successfully.
Unable to execute statement for table or stored procedure. 'IPCSDD_DOWNLOAD_PROCESS' (Structure 'StatementName1') due to java.sql.SQLException: ORA-00904: "P": invalid identifier
2010-10-19 22:29:59 Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
2010-10-19 22:29:59 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
Please find the system information below.
Oracle version- 10.2.4
XI version - 3.0/ service pack 19
JDBC driver- oracle.jdbc.driver.OracleDriver
Please suggest.
Thanks,
Venkata
Edited by: Venkata Narayana Eepuri on Oct 21, 2010 12:10 AMDear Venkata Narayana,
Concerning the error, kindly go through the following note :
731 - Collective note: ORA-00904
follow the recommendations mentioned in that and please check if that helps.
Best Regards
Nishwanth -
How to connect oracle database using DSN from jsp
hello, can any know how can i connect to[b] oracle database using DSN name from jsp .I am using oracle 9i and Tomcat 5
Using odbc tool i have created the dsn name but ithe connection does not make .here is the code that i have tried
Connection connection = null;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
catch(ClassNotFoundException Exception)
out.println("error occoured during loading the driver ");
try
out.println("getting the connection");
connection = DriverManager.getConnection("jdbc:oracle:deepak","scott","tiger");
out.println("connection getted");
catch(Exception exception1)
out.println("error occoured ");
pls help as soon as possible
Sorry, for my englishyou are actually using JDBC so the DSN entry does not matter.
2 things.
Make sure that your oracle database driver is in your classpath on your tomcat server.
I.E. copy the file classes12.jar into your common/lib folder of tomcat, or into your WEB-INF/lib folder of your application. and RESTART your server. classes12.jar can be found on the internet or more easily somewhere within your oracle installation. just search for it.
Make sure your jdbc url is correct. I believe it goes like this.... fill in the blacks
connection conn = DriverManager.getConnection("jdbc:oracle:thin:scott/tiger@MyOracleHost:1521:MyDB");Note how the username are passed in the first string there fore there is no need to pass additional parameters. This method may be depriciated, but if so, just take out the user and pass from the string and continue to pass them as 3 seperate strings.
connection conn = DriverManager.getConnection("jdbc:oracle:thin:MyOracleHost:1521:MyDB","scott","tiger");That should get your connection. if not, post your errors. -
Hi All,
How to connect the Oracle database using C/C++ on Mac OS X? I have used Instant Client library "instantclient-basic-macosx-10.1.0.3" provided by the Oracle but could not be success. I'm using PowerPC G4, Mac OS X 10.4.9, and XCode version 2.4.1.
Specially Mr Oscar Armanini has done this in C on Mac OS X. Please let me know. I would be very thankful to you.
Thanks,
GhufranHi Ghufran
there are two Metalink Notes on using Instant Client with PowerPc Mac:
https://metalink.oracle.com/metalink/plsql/showDoc?db=NOT&id=316497.1
How to Install, Configure and Test Oracle 10g Instant Client Basic,
SQL*Plus and SDK Packages for Mac OS X
(Runs OCI sample code - cdemo81.c)
https://metalink.oracle.com/metalink/plsql/showDoc?db=NOT&id=332588.1
How to Install, Configure and Test Oracle 10g Instant Client Basic,
SQL*Plus and SDK Packages for Mac OS X
(Runs OCCI sample code - occidml.cpp)
The first Metalink Note uses an OCI examples and it is pasted here below,
in case you don't have a Metalink ID.
The second Metalink Note uses an OCCI example.
I have never used Instant Client (neither on Os X or on other platform),
but I was successful on compiling C programs (no GUI involved) using the
Full Client installed on my PowerBook G4.
I'm a DBA, but I was a developer years ago (about when Oracle 7.3
was considered a giant step forward): I installed the Oracle 10.1 db
(a complicated job for a developer) and I got the Full Client
installed as well, for free, so I was happy to compile one of the demo C sources
(those that you can find in the Oracle Pro*C manuals:
by the way, Oracle Pro*C manuals are really worth reading).
Good luck
Oscar
Applies to: Oracle Server - Enterprise Edition - Version: 10.1.0.3
Apple Macintosh PowerPC
Goal
This article will show you how to install and configure your 10g Instant Client (IC) Software for the Mac.
It will install the following packages:
the Basic package
the SQL*Plus package and
the SDK package
and then test its connectivity to an Oracle database using SQL*Plus.
It will also show you how to setup and test a sample program, cdemo81.c, that uses the Oracle Call Interface (OCI)
to connect to the database.
The sample program is located under the <Instant_Client>/sdk/demo directory.
Solution1. Download the following three (3) files from the Oracle Technology Network (OTN) website.
You will need an account to do this.
Macintosh OS X 10g Instant Client Software
a. instantclient-basic-macosx-10.1.0.3.zip (32,395,622 bytes)
b. instantclient-sqlplus-macosx-10.1.0.3.zip (326,740 bytes)
c. instantclient-sdk-macosx-10.1.0.3.zip (293,913 bytes)
NOTE: The above three (3) files will be updated as new patches are released for the 10g Instant Client software. 10.1.0.3 or later versions (10.1.0.x) of these files may be used similarly with this article.
2. Save the following text into a file called tnsnames.ora:
# If you receive an
# ORA-12154: TNS:could not resolve the connect identifier specified
# error when running the setup script and attempting to connect to Oracle
# from SQL*Plus then the name of your SERVICE NAME (i.e. ORCL) may require
# that you include the DOMAIN (i.e. US.ORACLE.COM) in order to connect successfully.
# To obtain the DOMAIN of your environment, type "hostname" from your shell
# and it should report this information back to you. Configure your SERVICE
# NAME to look like Example 2.
# Example 1
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = database_machine.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
# Example 2
#ORCL.US.ORACLE.COM =
# (DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = database_machine.us.oracle.com)(PORT = 1521))
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SID = orcl)
3. Save the following text into a file called sqlplus_script.sql:
SELECT user FROM dual;
SELECT sysdate FROM dual;
SELECT 'successful ' AS TEST_RESULTS FROM dual;
exit;
4. Save the following text into a file called setup1:
# ===========================================
# MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP1
# ===========================================
# DESCRIPTION
# ===========
# This script will install and configure your 10g Instant Client (IC) Software
# for the Mac. It will install the Basic, SQL*Plus and SDK (OCI/OCCI) packages
# and then test its connectivity to an Oracle database using SQL*Plus.
# Once this script has completed, you will need to run the script SETUP2 to build
# and run the CDEMO81.C sample application located under the <IC>/sdk/demo folder
# in your newly installed Instant Client home.
# NOTE: In order for this script to run successfully, you MUST perform any
# necessary actions required under the SETUP section below.
# SETUP
# =====
# (1) You MUST be in a directoy with ALL of the following files
# BEFORE running this script:
# 1 - instantclient-basic-macosx-10.1.0.3.zip
# 2 - instantclient-sqlplus-macosx-10.1.0.3.zip
# 3 - instantclient-sdk-macosx-10.1.0.3.zip
# 4 - tnsnames.ora (configured properly)
# 5 - sqlplus_script.sql (connectivity test)
# 6 - setup1 (this file)
# 7 - setup2 (will run this file later)
# (2) Edit the TNSNAMES.ORA file and update it with the necessary information
# to connect to a database on your network. Be sure to note the comments
# in this file. You will have to change the following information:
# SERVICE NAME (orcl or orcl.us.oracle.com)
# HOST (database_machine.us.oracle.com)
# PORT (1521)
# SID (orcl)
# (3) Go to the end of this scrip and modify the following line:
# ./instantclient10_1/sqlplus scott/tiger@orcl @sqlplus_script.sql
# Replace "orcl" with the SERVICE NAME you used in step (2) above.
# (4) To run this script use the command: ". setup1"
# BEGINNING OF SCRIPT
# output this file to your shell
echo
echo MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP1
echo
#more setup1
# output the TNSNAMES.ORA file to your shell
echo TNSNAMES.ORA FILE
echo
more tnsnames.ora
# remove the instantclient10_1 directory should it exist
echo
echo CHECKING FOR instantclient10_1 DIRECTORY...
echo WILL REMOVE DIRECTORY IF IT ALREADY EXISTS
echo
rm -d -f -R instantclient10_1
# extract the instantclient software (basic, sql*plus & sdk)
echo
echo
echo INSTALLING SOFTWARE...
echo
echo BASIC
echo
unzip instantclient-basic-macosx-10.1.0.3.zip
echo
echo SQL*PLUS
echo
unzip instantclient-sqlplus-macosx-10.1.0.3.zip
echo
echo SDK
echo
unzip instantclient-sdk-macosx-10.1.0.3.zip
# set the following environment variables
# Uncomment if you want a way to find the Instant Client (IC) home quickly
#export IC=$PWD/instantclient10_1
# Dynamic Library path required to use the Instant Client (IC) software
export DYLD_LIBRARY_PATH=$PWD/instantclient10_1
# TNS_ADMIN is required if using the TNSNAMES.ORA file (recommended)
export TNS_ADMIN=$PWD/instantclient10_1
# display the modified environment variables
echo
echo SETTING ENVIRONMENT VARIABLES
echo
echo DYLD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH
echo
echo TNS_ADMIN
echo $TNS_ADMIN
# display all environment variables
#echo
#echo ALL ENVIRONMENT VARIABLES
#echo
#env
# copy the TNSNAMES.ORA to the instantclient directory
echo
echo COPYING TNSNAMES.ORA TO INSTANT CLIENT [IC] DIRECTORY
echo
cp tnsnames.ora ./instantclient10_1/tnsnames.ora
# list the contents of the IC directory to see what has been installed
echo
echo INSTANT CLIENT [IC] DIRECTORY
echo
ls ./instantclient10_1
echo
# SQL*Plus Connectivity Test
# To connect to the database specified in your TNSNAMES.ORA file change the
# SERVICE NAME (i.e. orcl) below to the name of the entry in your TNSNAMES.ORA
# file designating the specific database in which you want to connect to
echo
echo SQL*PLUS CONNECTIVITY TEST
./instantclient10_1/sqlplus scott/tiger@orcl @sqlplus_script.sql
# Alternately, you can connect from SQL*Plus to Oracle without using a TNSNAMES.ORA
# file. You can embed the NAME-VALUE pair of the SERVICE NAME from the TNSNAMES.ORA
# file directly into the connection string making sure to use the proper HOST, PORT
# and SID like so:
#./instantclient10_1/sqlplus scott/tiger@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=database_machine.us.oracle.com)(PORT=1521)))(CONNECT_DATA=(SID=orcl)))
5. Save the following text into a file called setup2:
# ===========================================
# MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP2
# ===========================================
# DESCRIPTION
# ===========
# This script will build and run the OCI sample application CDEMO81.C inside
# your Instant Client (IC) software located under the <IC>/sdk/demo folder.
# NOTE: In order for this script to run successfully
# (A) you MUST have already run the script SETUP1 successfully
# and
# (B) you MUST perform any necessary actions required under the SETUP
# section below.
# SETUP
# =====
# (1) You need to edit the CDEMO81.C application PRIOR to running this script to
# change the connection information. By default, the application will attempt
# to connect as user SCOTT with password TIGER to a local Oracle database using
# the BEQ-LOCAL network protocol. This will not work.
# (A) You need to make sure you have the SCOTT/TIGER schema created in your database.
# If not, have your DBA create it by running the script "SCOTT.SQL" from your
# <ORACLE_HOME>/rdbms/admin folder.
# (B) You need to modify the CDEMO81.C application to connect to the database
# you have configured inside your TNSNAMES.ORA file.
# (i) Open the CDEMO81.C file located under the <IC>/sdk/demo folder.
# (ii) Find the following line of code:
# (void) OCIServerAttach( srvhp, errhp, (text *)"", strlen(""), 0);
# and change the two empty strings to the SERVICE NAME you are using like so
# (void) OCIServerAttach( srvhp, errhp, (text *)"ORCL", strlen("ORCL"), 0);
# (iii) Save the file.
# (2) You MUST be in the initial directory where you copied all of the files listed
# in script SETUP1. In this same location you will find SETUP2. Run SETUP2 from
# this location.
# (3) To run this script use the command: ". setup2"
# BEGINNING OF SCRIPT
# output this file to your shell
echo
echo MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP2
echo
#more setup2
# output the TNSNAMES.ORA file to your shell
echo TNSNAMES.ORA FILE
echo
more tnsnames.ora
# output the username, password and service name from CDEMO81.C file to your shell
echo
echo USERNAME, PASSWORD AND SERVICE NAME INFO FROM YOUR OCI cdemo81.c FILE
echo
#more ./instantclient10_1/sdk/demo/cdemo81.c
grep -i "*username" ./instantclient10_1/sdk/demo/cdemo81.c
grep -i "*password" ./instantclient10_1/sdk/demo/cdemo81.c
grep -i OCIServerAttach ./instantclient10_1/sdk/demo/cdemo81.c
# display the required environment variables
#env
echo
echo REPORTING REQUIRED ENVIRONMENT VARIABLES
echo
echo DYLD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH
echo
echo TNS_ADMIN
echo $TNS_ADMIN
# move to the sdk/demo directory
cd ./instantclient10_1/sdk/demo
echo
echo CHANGING TO [IC]/SDK/DEMO DIRECTORY
echo
ls
# run demo application
echo
echo ATTEMPTING TO RUN APPLICATION
echo
echo BUILDING APPLICATION USING PROVIDED MAKE FILE, [IC]/sdk/demo/demo.mk...
echo
make -f demo.mk
echo
echo
echo INSTANT CLIENT [IC] DIRECTORY...
echo
ls ../..
echo
echo CREATING links FOR REQUIRED LIBRARIES IN INSTANT CLIENT [IC] FOLDER...
echo
echo - libclntsh.dylib
echo - libocci.dylib
ln ../../libclntsh.dylib.10.1 ../../libclntsh.dylib
ln ../../libocci.dylib.10.1 ../../libocci.dylib
echo
echo INSTANT CLIENT [IC] DIRECTORY WITH links CREATED...
echo
ls ../..
echo
echo
echo EXECUTING APPLICATION...
echo
cdemo81
echo
echo
# TROUBLE-SHOOTING
# If you receive the following error messages:
# Error - ORA-24327: need explicit attach before authenticating a user
# Error - ORA-03114: not connected to ORACLE
# Then you did not modify the CDEMO81.C application with proper SERVICE NAME
# information. See step 1B under the SETUP section in this script to resolve
# this error.
6. Take all seven (7) files and move them into the same directory on your OS where you want to install the Instant Client software from:
1 - instantclient-basic-macosx-10.1.0.3.zip
2 - instantclient-sqlplus-macosx-10.1.0.3.zip
3 - instantclient-sdk-macosx-10.1.0.3.zip
4 - tnsnames.ora
5 - sqlplus_script.sql
6 - setup1
7 - setup2
7. Open the file tnsnames.ora. Be sure to review the comments in this file. You will have to change the following information to connect to a database on your network:
SERVICE NAME (orcl or orcl.us.oracle.com)
HOST (database_machine.us.oracle.com)
PORT (1521)
SID (orcl)
Save the file.
8. Open the file setup1, go to the end of this script and modify the following line:
./instantclient10_1/sqlplus scott/tiger@orcl @sqlplus_script.sql
Replace orcl with the SERVICE NAME you used in Step 7 above. Save the file.
9. You are now ready to install the 10g Instant Client software for Mac OS X. From the location where your seven (7) files reside, issue the following command:
[macosx]/oracle> . setup1
NOTE: Be sure to include the period "." and a space " " before the word "setup1" so all environment variables persist for the current session.
This will install the Instant Client Basic and SQL*Plus software and connect to the database specified in the tnsnames.ora file.
10. Here is the sample output of a successful execution of the setup1 script:
[macosx]/oracle> . setup1
MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP1
TNSNAMES.ORA FILE
# If you receive an
# ORA-12154: TNS:could not resolve the connect identifier specified
# error when running the setup script and attempting to connect to Oracle
# from SQL*Plus then the name of your SERVICE NAME (i.e. ORCL) may require
# that you include the DOMAIN (i.e. US.ORACLE.COM) in order to connect successfully.
# To obtain the DOMAIN of your environment, type "hostname" from your shell
# and it should report this information back to you. Configure your SERVICE
# NAME to look like Example 2.
# Example 1
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
# Example 2
#ORCL.US.ORACLE.COM =
# (DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SID = orcl)
CHECKING FOR instantclient10_1 DIRECTORY...
WILL REMOVE DIRECTORY IF IT ALREADY EXISTS
INSTALLING SOFTWARE...
BASIC
Archive: instantclient-basic-macosx-10.1.0.3.zip
inflating: instantclient10_1/classes12.jar
inflating: instantclient10_1/libclntsh.dylib.10.1
inflating: instantclient10_1/libnnz10.dylib
inflating: instantclient10_1/libocci.dylib.10.1
inflating: instantclient10_1/libociei.dylib
inflating: instantclient10_1/libocijdbc10.dylib
inflating: instantclient10_1/ojdbc14.jar
SQL*PLUS
Archive: instantclient-sqlplus-macosx-10.1.0.3.zip
inflating: instantclient10_1/README_IC.htm
inflating: instantclient10_1/glogin.sql
inflating: instantclient10_1/libsqlplus.dylib
inflating: instantclient10_1/sqlplus
SDK
Archive: instantclient-sdk-macosx-10.1.0.3.zip
creating: instantclient10_1/sdk/
creating: instantclient10_1/sdk/demo/
inflating: instantclient10_1/sdk/demo/cdemo81.c
inflating: instantclient10_1/sdk/demo/demo.mk
inflating: instantclient10_1/sdk/demo/occidemo.sql
inflating: instantclient10_1/sdk/demo/occidemod.sql
inflating: instantclient10_1/sdk/demo/occidml.cpp
creating: instantclient10_1/sdk/include/
inflating: instantclient10_1/sdk/include/nzerror.h
inflating: instantclient10_1/sdk/include/nzt.h
inflating: instantclient10_1/sdk/include/occi.h
inflating: instantclient10_1/sdk/include/occiAQ.h
inflating: instantclient10_1/sdk/include/occiCommon.h
inflating: instantclient10_1/sdk/include/occiControl.h
inflating: instantclient10_1/sdk/include/occiData.h
inflating: instantclient10_1/sdk/include/occiObjects.h
inflating: instantclient10_1/sdk/include/oci.h
inflating: instantclient10_1/sdk/include/oci1.h
inflating: instantclient10_1/sdk/include/oci8dp.h
inflating: instantclient10_1/sdk/include/ociap.h
inflating: instantclient10_1/sdk/include/ociapr.h
inflating: instantclient10_1/sdk/include/ocidef.h
inflating: instantclient10_1/sdk/include/ocidem.h
inflating: instantclient10_1/sdk/include/ocidfn.h
inflating: instantclient10_1/sdk/include/ociextp.h
inflating: instantclient10_1/sdk/include/ocikpr.h
inflating: instantclient10_1/sdk/include/ocixmldb.h
inflating: instantclient10_1/sdk/include/odci.h
inflating: instantclient10_1/sdk/include/oratypes.h
inflating: instantclient10_1/sdk/include/ori.h
inflating: instantclient10_1/sdk/include/orid.h
inflating: instantclient10_1/sdk/include/orl.h
inflating: instantclient10_1/sdk/include/oro.h
inflating: instantclient10_1/sdk/include/ort.h
inflating: instantclient10_1/sdk/include/xa.h
SETTING ENVIRONMENT VARIABLES
DYLD_LIBRARY_PATH
/oracle/instantclient10_1
TNS_ADMIN
/oracle/instantclient10_1
COPYING TNSNAMES.ORA TO INSTANT CLIENT [IC] DIRECTORY
INSTANT CLIENT [IC] DIRECTORY
README_IC.htm libocci.dylib.10.1 sdk/
classes12.jar libociei.dylib* sqlplus*
glogin.sql libocijdbc10.dylib* tnsnames.ora
libclntsh.dylib.10.1* libsqlplus.dylib*
libnnz10.dylib ojdbc14.jar
SQL*PLUS CONNECTIVITY TEST
SQL*Plus: Release 10.1.0.3.0 - Production on Fri Aug 19 15:26:08 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
USER
SCOTT
SYSDATE
19-AUG-05
TEST_RESULTS
successful
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
IF THE SQL*PLUS CONNECTIVITY TEST WAS SUCCESSFUL
READ SETUP2 TO CONFIGURE AND RUN THE OCI cdemo81.c SAMPLE
[macosx]/oracle>
11. Once you have obtained a successful execution of the setup1 script, you are ready to configure cdemo81.c to connect to the database you have configured inside your tnsnames.ora file.
Open the cdemo81.c file located under the <Instant_Client>/sdk/demo folder. Find the following line of code:
(void) OCIServerAttach( srvhp, errhp, (text *)"", strlen(""), 0);
Change the two (2) empty strings to the SERVICE NAME you used in Step 7 above.
(void) OCIServerAttach( srvhp, errhp, (text *)"ORCL", strlen("ORCL"), 0);
Save the file.
12. You are now ready to run cdemo81.c. You MUST issue the following command from the initial directory where you copied all of the files in Step 6:
[macosx]/oracle> . setup2
NOTE: Be sure to include the period "." and a space " " before the word "setup2" so all environment variables persist for the current session.
This script will configure your environment, build and run the OCI sample code connecting to the database specified in the tnsnames.ora file.
13. Here is the sample output of a successful execution of the setup2 script:
[macosx]/oracle> . setup2
MAC OS X INSTANT CLIENT 10g SCRIPT - SETUP2
TNSNAMES.ORA FILE
# If you receive an
# ORA-12154: TNS:could not resolve the connect identifier specified
# error when running the setup script and attempting to connect to Oracle
# from SQL*Plus then the name of your SERVICE NAME (i.e. ORCL) may require
# that you include the DOMAIN (i.e. US.ORACLE.COM) in order to connect successfully.
# To obtain the DOMAIN of your environment, type "hostname" from your shell
# and it should report this information back to you. Configure your SERVICE
# NAME to look like Example 2.
# Example 1
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = orcl)
# Example 2
#ORCL.US.ORACLE.COM =
# (DESCRIPTION =
# (ADDRESS = (PROTOCOL = TCP)(HOST = gbednars-pc.us.oracle.com)(PORT = 1521))
# (CONNECT_DATA =
# (SERVER = DEDICATED)
# (SID = orcl)
USERNAME, PASSWORD AND SERVICE NAME INFO FROM YOUR OCI cdemo81.c FILE
static text username = (text ) "SCOTT";
static text password = (text ) "TIGER";
(void) OCIServerAttach( srvhp, errhp, (text *)"ORCL", strlen("ORCL"), 0);
REPORTING REQUIRED ENVIRONMENT VARIABLES
DYLD_LIBRARY_PATH
/oracle/instantclient10_1
TNS_ADMIN
/oracle/instantclient10_1
CHANGING TO [IC]/SDK/DEMO DIRECTORY
cdemo81.c* demo.mk occidemo.sql occidemod.sql occidml.cpp
ATTEMPTING TO RUN APPLICATION
BUILDING APPLICATION USING PROVIDED MAKE FILE, [IC]/sdk/demo/demo.mk...
rm -rf SunWS_cache
rm -rf ../../libclntsh.dylib
rm -rf ../../libocci.dylib
rm -rf cdemo81 cdemo81.o occidml occidml.o
/usr/bin/gcc -c -I../include -I/rdbms/public/ -I/oracore/include -I/oracore/publ
ic -I/oracore/port/include -I/nlsrtl/include -I/plsql/public -I/plsql/include -I
/network/public -I/network/include -I/otrace/public -I/otrace/include/ -I/precom
p/public -I/precomp/include/ -I/slax/include -I/ordts/public -I/ordts/include -I
/javavm/include -I/javavm/include/osds/unix/solaris -I/ctx/public -I/ordvir/publ
ic -I/ordvir/include -idirafter . -g -DRE_ENTRANT -DOCCI_NO_WSTRING=1 -DMAC_O
SX -D_GNU_SOURCE -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -D_BCER
T_API_ -DRSA_PLATFORM=RSA_PLATFORM_MAC_PPC_DARWIN -DNTEV_USE_POLL -DNTEV_USE_GE
NERIC -DNET_USE_LDAP -DOCCI cdemo81.c
ln ../../libclntsh.dylib.10.1 ../../libclntsh.dylib
ln ../../libocci.dylib.10.1 ../../libocci.dylib
/usr/bin/g++ -o cdemo81 cdemo81.o -L../../ -locci -lclntsh -lpthread
rm -rf ../../libclntsh.dylib
rm -rf ../../libocci.dylib
/usr/bin/g++ -c -I../include -I/rdbms/public/ -I/oracore/include -I/oracore/publ
ic -I/oracore/port/include -I/nlsrtl/include -I/plsql/public -I/plsql/include -I
/network/public -I/network/include -I/otrace/public -I/otrace/include/ -I/precom
p/public -I/precomp/include/ -I/slax/include -I/ordts/public -I/ordts/include -I
/javavm/include -I/javavm/include/osds/unix/solaris -I/ctx/public -I/ordvir/publ
ic -I/ordvir/include -idirafter . -g -DRE_ENTRANT -DOCCI_NO_WSTRING=1 -DMAC_O
SX -D_GNU_SOURCE -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -D_BCER
T_API_ -DRSA_PLATFORM=RSA_PLATFORM_MAC_PPC_DARWIN -DNTEV_USE_POLL -DNTEV_USE_GE
NERIC -DNET_USE_LDAP -DOCCI occidml.cpp
In file included from ../include/occi.h:43,
from occidml.cpp:11:
../include/occiData.h:411: warning: use of `long double' type; its size may
change in a future release
../include/occiData.h:411: warning: (Long double usage is reported only once
for each file.
../include/occiData.h:411: warning: To disable this warning, use
-Wno-long-double.)
ln ../../libclntsh.dylib.10.1 ../../libclntsh.dylib
ln ../../libocci.dylib.10.1 ../../libocci.dylib
/usr/bin/g++ -o occidml occidml.o -L../../ -locci -lclntsh -lpthread
rm -rf ../../libclntsh.dylib
rm -rf ../../libocci.dylib
INSTANT CLIENT [IC] DIRECTORY...
README_IC.htm libocci.dylib.10.1 sdk/
classes12.jar libociei.dylib* sqlplus*
glogin.sql libocijdbc10.dylib* tnsnames.ora
libclntsh.dylib.10.1* libsqlplus.dylib*
libnnz10.dylib ojdbc14.jar
CREATING links FOR REQUIRED LIBRARIES IN INSTANT CLIENT [IC] FOLDER...
- libclntsh.dylib
- libocci.dylib
INSTANT CLIENT [IC] DIRECTORY WITH links CREATED...
README_IC.htm libnnz10.dylib libsqlplus.dylib*
classes12.jar libocci.dylib ojdbc14.jar
glogin.sql libocci.dylib.10.1 sdk/
libclntsh.dylib* libociei.dylib* sqlplus*
libclntsh.dylib.10.1* libocijdbc10.dylib* tnsnames.ora
EXECUTING APPLICATION...
Enter employee name (or CR to EXIT): LARRY
Enter employee job: CEO
Enter employee salary: 10000
Enter employee dept: 40
LARRY added to the OPERATIONS department as employee number 7974
Enter employee name (or CR to EXIT):
Exiting...
[macosx]/oracle/instantclient10_1/sdk/demo>
14. If you have any problems running this script please open a Service Request (SR) with Oracle Support for further assistance and be sure to upload the output from the script to the SR.
ReferencesNote
332588.1 - How to Install, Configure and Test Oracle 10g Instant Client Basic, SQL*Plus and SDK Packages for Mac OS X (Runs OCCI sample code - occidml.cpp)
Errors
ORA-3114 "not connected to ORACLE"
ORA-24327 need explicit attach before authenticating a user
ORA-12154 "TNS:could not resolve service name" -
How to connect oracle database using jsf
how to connect oracle database using javaserver faces with connection pooling
Here is one way...
http://jakarta.apache.org/commons/dbcp/ -
Connect to oracle database using c program
I am using AIX environment and i want to connect to oracle database using c program.
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10825/pc_03dbc.htm#i5880
-
How does one connect to an Oracle Database using OO4O as sysdba using VB 6?
Hi,
Can any one give suggestion to connect an Oracle Database using OO4O as sysdba using VB 6.0. Generally it supports only database, userid/password only.
For Eg:
Option Explicit
Dim m_oraSession As Object
Dim m_oraDatabase As Object
Private Sub Command1_Click()
Set m_oraSession = CreateObject("OracleInProcServer.XOraSession")
Set m_oraDatabase = m_oraSession.DBOpenDatabase("Database", "user/password", 0&)
MsgBox "Connected to " & m_oraDatabase.Connect & "@" & m_oraDatabase.DatabaseName
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set m_oraDatabase = Nothing
Set m_oraSession = Nothing
End Sub
Thanks & Regards,
Kishore.P
E-Mail: [email protected]You can't connect AS SYSDBA with OO4O.
-
Delete old records in oracle database using jobs
Hi,
will it be possible to delete old records in oracle database using jobs
need to delete old records on weekly basis and rebuild my index.
Thanks!933633, While it is possible to do a great deal with the dbms_scheduler your shop should have a scheduler like CA Unicenter that is used to run the application job schedules. Purge jobs should probably be part of the normal application schedule rather than contained in the database, if your shop has a scheduler in use.
As far as rebuilding the indexes after the purge keep in mind that freshly rebuilt indexes often have to split when inserts are performed due to the fact the compacted index blocks do not have room to hold the newly inserted keys in the appropriate locations. So just because you purge weekly does not automatically mean the indexes should be rebuilt weekly. You need to look at the index key DML pattern and at the total percentage of the index that is held by deleted rows.
HTH -- Mark D Powell -- -
What commands used for taking backup of oracle database using BR*Tools
Can somebody please help me urgently to know what are the commands used for taking backup of oracle database using BR TOOLS.Also specifythe commands in detail which can be used for taking backups of oracle database ,Online Redo log files in databse using BRBACK tool,Archiving of offline, redo log files using BRARCHIVE, and Restoring a Database using BRRESTORE tool Commands(Plese specify the commands with their Syntax used).Also specify the commands with their Syntax which are used for taking backup of oracle database(online,Offline redo log files) into Tapedrives using BRTOOLS commands.
Thanking You for helping (in advance).Dear Ashish,
BRBACKUP / BRARCHIVE calls the operating system command to copy the files.
Simple approach to get the commands is as follows.
1. Set the BR_TRACE (as given in the SAP note 29321) and run the command for which you need to know the OS / SQL commands.
2. This will generate the log file with the trace information. This trace has the information of the commands used by the job you have run.
Hope this helps.
Regards,
Madhukar
Maybe you are looking for
-
My iphone will not sync music, I have done it many times before , there is 4,6 GB space it just remains stuck at step 6 of 6 for over an hour, any ideas what is wrong?
-
Cisco ISE 1.2 - BYOD Guest Access Error with Certificate
Hi all ! I'm running on Cisco ISE 1.2. I'm trying to setup BYOD (dual SSID). Here's a walkthrough of what's happening: 1. I connect to open SSID, enter username/password and register MAC 2. I download WinSPwizard, get trust root CA but WinSPwizard e
-
Weird add/remove child layout behavior
I'm trying to build an an app that allows the user to toggle certain panels on and off. These panels are in Divider containers. It seems that at startup, when I remove and add a panel flex doesn't properly validate layout. For example 2 panels are ad
-
CSS WON'T GET COLOR CODED UNLESS THE FILE IS IN A PROJECT?? R U KIDDIN??
If I open a CSS file outside of a project, there is no color coding! Please tell me this can be changed. I DO NOT WANT CFBUILDER ORGANIZING MY PROJECTS! $299 for this? Really - please explain why I should pay $300 for a bloated version of Homesite?
-
OVM disks for RAC implementation
Dear All is there any guide available on how can you create the disks for RAC ASM in OVM 3.3.1 using a fiber channel block level storage? Thanks George