Using Oracle Objects In Sqlj Programs
I had 8.1.5 installed under Mandrake 7.0 and working fine. 8.1.6 installed fine, but dbassist could not create the database at all. I had tried Mandrake 7.1b and Redhat 6.2 with all having the same problem of not being able to create the database.
I had to use RH 6.1 to make it work then I did an upgrade to Mandrake 7.1 on top of it. I could still access the database and create/edit tables.
I have not narrowed-down what the difference is in why it installs under 6.1 and I can upgrade but not a straight install from RH 6.2 or Mandrake 7.x.
- I did remove java 1.1.6v3
- I set the default oracle directory to /u01
Good luck!
-Steve
I'm facing the same problem here, I wonder if you have found a solution yet...
I need to take res in php into an object:
TYPE L_TEST AS OBJECT
id NUMBER(10),
name varchar2(100)
PROCEDURE TEST_P1(test_number IN NUMBER, res out l_test)
IS
BEGIN
res:=l_test(test_number,'test value ='||test_number);
END;
Similar Messages
-
Is there a way to use business objects in the program or function module?
Hi Experts,
Is there a way to use business objects in the program or function module.
Thanks in Advance.
Naval bhattHi Naval,
Ofcourse you can use business objects in your programms/ methods.
You can use function modules or macros (available from include <cntn01>) for using business objects in your application.
refere following two links for startup information
http://www.sap-img.com/abap/reading-attribute-of-a-business-object-in-abap.htm
http://www.jt77.com/business-warehouse/work-flow-12619.html
Regards,
Abhijit -
Problem using Oracle Object Types and Arrays.
I'm currently trying to work with oracle object types in java and I'm running into some issues when trying to add an item to an array.
The basic idea is that I have a header object and a detail object (both only containing an ID and a description). Inside of my java code I'm trying to add a new detail line to the header that has been retrieved from the database.
Here's what I'm working with.
--Oracle Objects:
CREATE OR REPLACE TYPE dtl_obj AS OBJECT
detail_id INTEGER,
header_id INTEGER,
detail_desc VARCHAR2(300)
CREATE TYPE dtl_tab AS TABLE OF dtl_obj;
CREATE OR REPLACE TYPE hdr_obj AS OBJECT
header_id INTEGER,
src VARCHAR(30),
details dtl_tab
CREATE TYPE hdr_tab AS TABLE OF hdr_obj;
/--Java test methods
public static void main(String[] args) throws SQLException,
ClassNotFoundException
// Initialize the objects
Test t = new Test();
t.connect(); //Connects to the database
//The oracle connection will be accessible through t.conn
// Create the oracle call
String query = "{? = call get_header(?)}";
OracleCallableStatement cs = (OracleCallableStatement) t.conn.prepareCall(query);
cs.registerOutParameter(1, OracleTypes.ARRAY, "HDR_TAB"); //Register the out parameter and associate it with our oracle type
int[] hdrs = { 240 }; //we just want one for testing.
ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor(
"ARRAY_T", t.conn);
oracle.sql.ARRAY oHdrs = new ARRAY(descriptor, t.conn, hdrs);
cs.setARRAY(2, oHdrs); //Set the headers to retrieve
// Execute the query
cs.executeQuery();
try
ARRAY invArray = cs.getARRAY(1);
// Start the retrieval process
Class cls = Class.forName(Header.class.getName());
Map<String, Class<?>> map = t.conn.getTypeMap();
map.put(Header._SQL_NAME, cls);
Object[] invoices = (Object[]) invArray.getArray();
ArrayList<Header> invs = new ArrayList(
java.util.Arrays.asList(invoices));
if (invs != null)
for (Header inv : invs)
System.out.println(inv.getHeaderId() + " " + inv.getSrc());
t.addDetail(inv, "new line");
for (Detail dtl : inv.getDetails().getArray()) // Exception thrown here
// java.sql.SQLException: Fail to construct descriptor: Invalid arguments
// at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
// at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
// at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
// at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:128)
// at oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:109)
// at com.pcr.tst.Detail.toDatum(Detail.java:40)
// at oracle.jpub.runtime.Util._convertToOracle(Util.java:151)
// at oracle.jpub.runtime.Util.convertToOracle(Util.java:138)
// at oracle.jpub.runtime.MutableArray.getDatumElement(MutableArray.java:1102)
// at oracle.jpub.runtime.MutableArray.getOracleArray(MutableArray.java:550)
// at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:689)
// at oracle.jpub.runtime.MutableArray.getObjectArray(MutableArray.java:695)
// at com.pcr.tst.DetailTable.getArray(DetailTable.java:76)
// at com.pcr.tst.Test.main(Test.java:91)
System.out.println(dtl.getDetailDesc());
catch (Exception ex)
System.out.println("Error while retreiving header");
ex.printStackTrace();
public void addDetail(Header hdr, String desc) throws Exception
if (hdr == null)
throw new Exception("header not initialized");
// Convert the current list to an ArrayList so we can easily add to it.
ArrayList<Detail> dtlLst = new ArrayList<Detail>();
dtlLst.addAll(java.util.Arrays.asList(hdr.getDetails().getArray()));
// Create the new detail
Detail dtl = new Detail();
dtl.setDetailDesc(desc);
// add the new detail
dtlLst.add(dtl);
Detail[] ies = new Detail[dtlLst.size()];
ies = dtlLst.toArray(new Detail[0]);
DetailTable iet = new DetailTable(ies);
hdr.setDetails(iet);
}I know its the addDetail method causing the issue because if I comment out the t.addDetail(inv, "new line"); call it works fine.
Message was edited by:
pcristiniOracle® Database Object-Relational Developer's Guide
Also note that object relational database design is often less performant and scalable than relational. It is not very often used in production environments.
However, the object orientated programming feature that is provided with Oracle object feature set are used and can make development and interfaces a lot easier.
So in a nutshell. Say no to ref and nested table columns. Say yes to most of the other object features. IMO of course... -
How to use Oracle objects in java code
Hi all!
I'm reading an xls and i need to fill me oracle objects with java code:
OBJECT_NAME OBJECT_TYPE
LETTURA_OBJ TYPE
LETTURA_OBJ TYPE BODY
In the past weeks i've been using both java code into oracle and oracle objects, but new i need to write those objects with data i read with java, anybody can help me?
I know that the easiest work around would be to put the data i read from the excel file into a table and then fill the oracle objects, but now i want to learn how to write directly those objects with a command like the following one:
a sample of the code i'm tryng to write:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
import java.io.*;
import java.io.IOException;
import jxl.*;
public cass ....
#sql{ variabili_globali.var_ER_F3.Tipo_Lettura := 5}
thanks,
Massimo
Edited by: LinoPisto on 16-mag-2011 16.38mmmh i'm not understanding so much....
well... as i told before i'm working in oracle database environment and i'm developing a java procedure.
now, i have this object
CREATE OR REPLACE
TYPE REPORT.FATTURA_OBJ AS OBJECT (
POD VARCHAR2(1000),
ID_FATTURA NUMBER,
ID_FILE NUMBER,
COERENZA_EA_F VARCHAR2(1000),
COERENZA_ER_F VARCHAR2(1000),
COERENZA_EA_M VARCHAR2(1000),
COERENZA_EF_M VARCHAR2(1000),
ANOMALIA VARCHAR2(1000),
MOTIVO_INVALIDAZIONE VARCHAR2(1000),
MATRICOLA_CONTATORE VARCHAR2(1000),
POTENZA_DISPONIBILE VARCHAR2(1000),
MEMBER PROCEDURE pulisci
/and i need to work with it inside this procedure:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
import java.io.*;
import java.io.IOException;
import java.io.StringWriter;
public class Manage_Excel_ASMBS
public static void read_Excel(String inputFile,int var_Id_Caricamento, int var_Id_Distributore, String var_Distributore) throws SQLException, IOException
**here i need to put what i'm reading inside the excel file into oracle objects**
/can you please give me a sample ?
thanks -
Use of Complex Oracle Object with JDBC
How can I use Oracle Object(or PL/Sql type) with JDBC
I have a structure of record with some attributes and table of another attribute.
My types are defined as follows !
<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>
My custom object might have the following structure (or should it be different)
<code>
public class EmpColl implements CustomDatum, CustomDatumFactory
-- other stuff ----
/* fields */
public String empName;
public Collection empNos;
</code>
I want to pass an variable of type EMPLOYEES to an procedure.
Thanx in Advance
Chetan
[email protected]<code>
CREATE TYPE EMPLOYEE_GRADES AS TABLE OF VARCHAR2(50)
CREATE TYPE EMPLOYEES AS OBJECT(EmpName VARCHAR2(50), EmpGrades Employee_Grades)
</code>The easiest is to use JPublisher (which comes with the SQLJ distribution).
Say:
jpub -user=username/password -sql=EMPLOYEES:Employees,EMPLOYEE_GRADES:EmployeeGrades
You will get (among others) the Java files Employees.java and EmployeeGrade.java. Go ahead, compile and use them.
Look in [Oracle Home]/sqlj/demo/jpub for a number of additional examples, and in the JPublisher User's Guide for background info.
The next (9.2) release of JPublisher will also provide some support for accessing legacy PL/SQL types from Java. -
WIN : DISTRIBUTING ORACLE OBJECTS FOR OLE
제품 : ODBC
작성날짜 : 1997-12-09
WIN : DISTRIBUTING ORACLE OBJECTS FOR OLE
=========================================
Applications built using Oracle Objects for OLE when distributed need
a set of dynamic link libraries(DLLs). This bulletin supplements the information given in the Oracle Objects for OLE documentation.
It provides a complete list of DLLS and the steps necessary to run the executable on a production machine.
Once the executable is built, the executable needs to be shipped with
the following files. The files should be installed in \WINDOWS\SYSTEM directory of the production(runtime) machine. The files for different versions of Oracle Objects for OLE (OO4O) are listed below.
OO4O 1.x OO4O 2.0 OO4O 2.1
===========================================================
ORAIPSRV.DLL OIP20WIN.DLL OIP21WIN.DLL
ORAIPSRV.REG ORAIPSRV.REG ORAIPSRV.REG
ORAIPSRV.TLB OIP20WIN.TLB OIP21WIN.TLB
ORADC.VBX ORADC.VBX ORADC.VBX
The following files are required for all the three versions of Oracle Objects
for OLE(OO4O).
COMPOBJ.DLL
OLE2.DLL
OLE2.REG
OLE2CONV.DLL
OLE2DISP.DLL
OLE2NLS.DLL
OLE2PROX.DLL
STDOLE.TLB
STORAGE.DLL
TYPELIB.DLL
In addition to the above files, make sure the runtime files required by
the application programming language are also installed in the right directories.
For example applications built using Visual Basic 3.0, require
VBOA300.DLL and VBRUN300.DLL.
Next, you must register in Windows the information found in
ORAIPSRV.REG and OLE2.REG
To register, make sure that you have REGEDIT.EXE in your \WINDOWS\SYSTEM
directory. In program manager choose File - Run, type
REGEDIT /S OLE2.REG
REGEDIT /S ORAIPSRV.REG
NOT registering will result in 'OLE initialization error'.
The files listed in this bulletin should not be redistributed to a
machine that already has Oracle Objects for OLE installed on it.
The target production machine should be clean. Oracle Objects for OLE
does not have a de-install option.
Make sure for Oracle Object for OLE Version 1.x, Required support files
( RSF 7.1.X ) is installed on your production machine.
An exception to the above rule is, if the application is built using
Oracle Objects for OLE Version 1.0.61,then Required Support files
(RSF 7.2) must be installed.
For Oracle Objects for OLE Version 2.0.x and Version 2.1.x, Required
support files ( RSF 7.3.X ) must be installed on your production
machine.
Do not distribute the Required Support files (RSF) files. This would
be a violation of the license agreement.
Also, check if the necessary networking software and SQL*Net Client
software is installed to connect to the database. Finally, make
certain that \ORAWIN\BIN is in your search path.
The information in this bulletin is a supplement to the Oracle
Objects for OLE online help.
The online help has a section on Redistributable Files.
You will see a hyperlink to this section on the contents page of the
help.Are you referring to the following?
http://download-west.oracle.com/docs/cd/B10501_01/win.920/a95895/toc.htm#
I simply went to the Documentation Index and did a search for this title.
Regards, OTN -
Oracle Object Types vs. Table Fields
Hello, all.
I`m totally new to Oracle, and I am facing a very hard problem for me, and I would like to ask your help.
I've been working on a project which uses Oracle Object Types, from a database of a legacy system.
I did not know Oracle Objects until 5 minutes ago, so sorry If I say something stupid:
Per my understanding, a Oracle Object Type can be formed by fields like myField varchar(200)... and fields from an existing table or view.
I have a lot of objects on my system and I need to map each field and its respective table or view that compose each object.
Does anyone have a query for that? I think it should be common, but I could not find anything at google (maybe I don`t which terms use to find...)
I would be very thankful if somebody could help (save) me.
Thanks in advance.
PauloFirst, it would help if you post what you object types look like.
I'm assuming they may look something like this:
SQL> create TYPE emp_type AS OBJECT
2 (emp_id NUMBER,
3 name VARCHAR2(20));
4 /
Type created.
SQL> create TYPE emp_tab IS TABLE OF emp_type;
2 /
Type created.
SQL> create or replace package emp_test as
2 procedure get_emps;
3 end emp_test ;
4 /
Package created.
SQL> create or replace package body emp_test as
2 employees emp_tab := emp_tab();
3 procedure get_emps as
4 g_rc sys_refcursor;
5 BEGIN
6 employees.EXTEND(2);
7 employees(1) := emp_type (1, 'John Smith');
8 employees(2) := emp_type (2, 'William Jones');
9 OPEN g_rc FOR
10 SELECT * FROM TABLE (CAST (employees AS emp_tab));
11 END get_emps ;
12 end emp_test ;
13 /
Package body created. -
Hello All,
Here is the issue description. Our application uses Oracle Object Types and LIST. We deployed our application on QA environment which has Oracle 10g. Application runs fine...no issues. Now we moved to UAT. UAT environment is same as QA environment and DBA have created replica of QA database.
Now WAR file which works fine with QA database , somehow doesnt work with UAT database. Application throws following exception when code tries to call getArray() on java.sql.Array.
We tried to point UAT weblogic to QA database and it worked fine.....but when we point UAT weblogic to UAT database , we get following exception. So we know that this is a database issue.
DBA claims that QA env database and UAT env database are same.
Can anybody please tell me what wrong here? What setting is not done on UAT database which is done on QA?
java.sql.SQLException: Internal Error at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227) at oracle.jdbc.oracore.OracleTypeCOLLECTION.initCollElemTypeName(OracleTypeCOLLECTION.java:975) at oracle.jdbc.oracore.OracleTypeCOLLECTION.getAttributeType(OracleTypeCOLLECTION.java:1005) at oracle.jdbc.oracore.OracleNamedType.getFullName(OracleNamedType.java:96) at oracle.jdbc.oracore.OracleTypeADT.createStructDescriptor(OracleTypeADT.java:1958) at oracle.jdbc.oracore.OracleTypeADT.unpickle81(OracleTypeADT.java:1432) at oracle.jdbc.oracore.OracleTypeUPT.unpickle81UPT(OracleTypeUPT.java:426) at oracle.jdbc.oracore.OracleTypeUPT.unpickle81rec(OracleTypeUPT.java:383) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81_imgBody_elems(OracleTypeCOLLECTION.java:928) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81_imgBody(OracleTypeCOLLECTION.java:872) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle81(OracleTypeCOLLECTION.java:692) at oracle.jdbc.oracore.OracleTypeCOLLECTION._unlinearize(OracleTypeCOLLECTION.java:217) at oracle.jdbc.oracore.OracleTypeCOLLECTION.unlinearize(OracleTypeCOLLECTION.java:189) at oracle.sql.ArrayDescriptor.toJavaArray(ArrayDescriptor.java:663) at oracle.sql.ARRAY.getArray(ARRAY.java:282) at weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY.getArray(Unknown Source)
Please help.425260 wrote:
This can happen if you use the oracle.sql.ARRAY class with WebLogic.
WebLogic wraps oracle.sql.ARRAY with its own class (i.e. weblogic.jdbc.wrapper.Array_oracle_sql_ARRAY). The easiest solution is to replace oracle.sql.ARRAY with the JDBC standard java.sql.Array.
<PRE class=jive-pre><CODE class="jive-code jive-java">Object[] items = (Object[])array.getArray();
<FONT color=navy><B>if</B></FONT> (items.length > 0) <FONT color=navy>{</FONT>
<FONT color=navy><B>for</B></FONT> (<FONT color=navy><B>int</B></FONT> i = 0; i < items.length; i++) <FONT color=navy>{</FONT>
Object arrayItem = items;
<FONT color=navy>}</FONT>
<FONT color=navy>}</FONT>
</CODE></PRE>
The <B>array</B> object is a java.sql.Array. Here no unwrapping of the WebLogic wrapper is needed.
If you absolutely need the oracle.sql.ARRAY class than you must use an <B>unwrap</B> API on the WebLogic wrapper class.
<PRE class=jive-pre><CODE class="jive-code jive-java"><FONT color=navy><B>if</B></FONT> (object <FONT color=navy><B>instanceof</B></FONT> weblogic.jdbc.wrapper.Array)
array = (ARRAY) ( ((weblogic.jdbc.wrapper.Array)object).unwrap(Class.forName(<FONT color=red>"oracle.sql.ARRAY"</FONT>)) );
<FONT color=navy><B>else</B></FONT>
array = (ARRAY) object;
</CODE></PRE>
Here, <B>array</B> is an oracle.sql.ARRAY. Try to see if this <A class=bodylinkwhite href="http://www.software-to-convert.com/3gp-conversion-software/3gp-to-myspace-video-software.html"><FONT face=tahoma,verdana,sans-serif color=#000 size=1>helps</FONT></A>. Good luck.
Thanks for your explanation! It's very valuable, It is exactly what I need, I understand this part. -
Connection pooling does not work Oracle Objects! Oracle please respond!
The problem is that when we retrieve Oracle Objects using pooled connection (closing logical connection at the end of every call)it takes 6-8 times longer than in case we share the same physical connection for all database calls. Parts of our application which do not utilize Oracle Objects (just old good relational data) works just fine with pooled connections - no performance degradation
This is my reconstruction of f the what is happening behind the seen, so some parts can be not entirely correct.
OracleConnection class caches StructDescriptor objects in descriptorCache hash table. StructDescriptor objects map content of oracle STRUCTs which are retrieved through the connection onto oracle type names. For example if you retrieve an instance of HR.EMPLOYEE_T oracle object from database some metadata will be retrieved and stored as an entry in descriptorCache cache table associated with "HR.EMPLOYEE_T" key to assist CustomDatum interface. It is a time consuming process and caching of this metadata improves it dramatically.
Now when using pooled connection descriptorCache gets cleared when you close your logical connection (java.sql.Connection) so next time you get a connection from your pooled connection it will have to repopulate the cache which as I said is very time consuming. As a result even though we can reuse our physical connection by using pooled connection whole setup does not work - fetching metadata takes a long time and we cant use Oracle objects in EJB environment (or Servlet environment)
Alex Roytman
Peace Technology, Inc.
(301) 206-9696
nullcheck out managed datasources in the manuals
-
Hi
I'm trying to debug a application (in 9i Release 2) using PL/SQL object types and was wondering if JDev can help.
I can see the objects, and their code, but the debugger seems unable to step into them, see local variables etc. It also incorrectly identifies code errors -- in short it appears to be using the 9i Release 1 drivers.
I've just installed version 9.0.3.2 but that hasn't helped. The release notes say helpfully that 9.0.3 can handle the drivers for 9i R2, but it won't use them!
I'm about to try the 10g preview, but I'm not feeling hopeful. Is this something I can expect to be fixed or do I have to find some other way of debugging my code?
Thanks,
Glenn.Hi,
I also have problems debugging oracle objects. I'm running an Oracle Database Version 9.2.0.1.0 and use
JDeveloper 9.0.3 to remotely debug PL/SQL Code. The debugging works fine when I'm setting breakpoints and
step through the code.
But I seem to be unable to list the value of variables of
object types and variables of nested table types. And of course I cannot set conditional breakpoints on variables that have an Oracle object type. If I try 10g, there is no improvement. The object types are not recognized as Oracle object types or nested table types, instead they are shown as $Oracle.builtin.OPAQUE
I need this feature to remotely debug procedures, that mostly use Oracle object types as parameters. Is there any possibility that I can get this feature to work? Otherwise JDeveloper is not much of a use for me when I'm debugging PL/SQL code.
Thanks,
Astrid
I provided an example, in which I create the above mentioned types and fill them with data, but where I'm unable to retrieve the values of the variables in JDeveloper:
---------------------EXAMPLE--------------------------
PROMPT Creating TYPE 'ot_hwemployee'
CREATE OR REPLACE TYPE ot_hwemployee AS OBJECT (
emp_id NUMBER (10),
emp_name VARCHAR2 (200)
PROMPT Creating TYPE 'nt_hwemployee'
CREATE OR REPLACE TYPE nt_hwemployee AS TABLE OF ot_hwemployee
PROMPT Creating TYPE 'nt_hwinteger'
CREATE OR REPLACE TYPE nt_hwinteger AS TABLE OF NUMBER (20)
PROMPT Creating PROCEDURE 'checkEmployees'
CREATE OR REPLACE PROCEDURE checkEmployees
AS
vnt_employees nt_hwemployee;
BEGIN
vnt_employees := nt_hwemployee(ot_hwemployee(1, 'Mustermann Max'),
ot_hwemployee(2, 'Beispiel Barbara'),
ot_hwemployee(3, 'Schober-Gant Astrid'));
deleteemployees(vnt_employees);
END checkEmployees;
PROMPT Creating PROCEDURE 'deleteEmployees'
CREATE OR REPLACE PROCEDURE deleteEmployees (
pnt_employees IN OUT nt_hwemployee)
AS
vnt_employees_deleted nt_hwinteger;
BEGIN
vnt_employees_deleted := nt_hwinteger();
FOR i IN pnt_employees.FIRST .. pnt_employees.LAST LOOP
IF (pnt_employees(i).emp_id > 2) THEN
vnt_employees_deleted.EXTEND;
vnt_employees_deleted(vnt_employees_deleted.COUNT) := pnt_employees(i).emp_id;
pnt_employees.delete(i);
END IF;
END LOOP;
END deleteEmployees;
-------------------------END EXAMPLE------------------- -
Using oracle.sql.STRUCT to pass in a COMPLEX OBJECT
I need to pass in a complex object (object with nested array of objects) into a oracle stored procedure.
We are using JDBC 9.2.0.1 drivers...
Note i am able to retrieve a complex object successfully using an oracle struct however i am not able to pass in the struct.
I do not want to use JPublisher as we are not using SQLJ.
I have looked through the documentation on using default structs and am getting an error when i try and create the struct...
I have created an array of objects with a sub array
and i create a struct descriptor however when i create the actual oracle struct
like
oracle.sql.Struct = new oracle.sql.Struct( structDesc,conn,complexobject)
I get a "java.sql.SQLException: Internal Error: Unable to resolve name"
Do i have to create STRUCTS for the nested object first ?
And then nest that STRUCT within the PARENT STRUCT to pass in complex objects ???
Any help would be much appreciated...
Gurinder
email [email protected]Thanks Konstantin Goryachev!
I'm using Oracle JDBC 9.2.0.3 drivers using a SQLData implementation.
Unfortunately i have something very similar to your code and i still get the following error
EXC: testPolicyRate(): java.sql.SQLException: Internal Error: Inconsistent catalog view
java.sql.SQLException: Internal Error: Inconsistent catalog view
void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)
DBError.java:187
void oracle.jdbc.dbaccess.DBError.throwSqlException(int, java.lang.Object)
DBError.java:229
void oracle.sql.StructDescriptor.initMetaData1_9_0()
StructDescriptor.java:897
void oracle.sql.StructDescriptor.initMetaData1()
StructDescriptor.java:864
boolean oracle.sql.StructDescriptor.isInstantiable()
StructDescriptor.java:508
void oracle.sql.STRUCT.<init>(oracle.sql.StructDescriptor, java.sql.Connection, java.lang.Object[])
STRUCT.java:107
oracle.sql.STRUCT oracle.sql.OracleSQLOutput.getSTRUCT()
OracleSQLOutput.java:96
oracle.sql.STRUCT oracle.sql.STRUCT.toSTRUCT(java.lang.Object, oracle.jdbc.OracleConnection)
STRUCT.java:408
oracle.sql.Datum oracle.jdbc.oracore.OracleTypeADT.toDatum(java.lang.Object, oracle.jdbc.driver.OracleConnection)
OracleTypeADT.java:284
oracle.sql.Datum[] oracle.jdbc.oracore.OracleTypeADT.toDatumArray(java.lang.Object, oracle.jdbc.driver.OracleConnection, long, int)
OracleTypeADT.java:327
oracle.sql.Datum[] oracle.jdbc.oracore.OracleTypeUPT.toDatumArray(java.lang.Object, oracle.jdbc.driver.OracleConnection, long, int)
OracleTypeUPT.java:143
oracle.sql.Datum[] oracle.sql.ArrayDescriptor.toOracleArray(java.lang.Object, long, int)
ArrayDescriptor.java:771
void oracle.sql.ARRAY.<init>(oracle.sql.ArrayDescriptor, java.sql.Connection, java.lang.Object)
ARRAY.java:118
void com.tu.lib.busobject.PolicyRate.main(java.lang.String[])
PolicyRate.java:198
Process exited with exit code 0.
Here's my code
* Main Method
public static void main(String[] args)
throws SQLException, IOException
Connection conn = null;
OracleCallableStatement cstmt = null;
try {
/* Setup connection */
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:@neptune:1521:tu_test", "OPS$WWW", "welcome1");
conn.setAutoCommit(false);
System.out.println("conn is open = " + !conn.isClosed());
/* Setup map */
System.out.println("Creating type maps...");
java.util.Map typeMap = conn.getTypeMap();
typeMap.put(_SQL_NAME,PolicyRate.class);
typeMap.put(CoverageRate._SQL_NAME, CoverageRate.class);
typeMap.put(CoverageRate._SQL_ARRAY_NAME,CoverageRate[].class);
conn.setTypeMap(typeMap);
/* Create a coverage rate object to be inserted into array of policy rate object */
CoverageRate covrObj = new CoverageRate(1,
"HMS",
30,
5,
new BigDecimal(0),
null,
null,
new BigDecimal(0),
new BigDecimal(0),
0,
0);
/* Create an array */
System.out.println("Creating descriptor...");
ArrayDescriptor adesc = new ArrayDescriptor(CoverageRate._SQL_ARRAY_NAME,conn);
System.out.println("Created descriptor!");
Object [] covrArray = new Object[1];
covrArray[0] = covrObj;
System.out.println("Creating oracle array..");
ARRAY arr = new ARRAY(adesc,conn,covrArray);
System.out.println("Created array!!");
/* Create policy rate object */
PolicyRate prate = new PolicyRate ("TESTTRA",
"TRS",
TUDate.convertToSql("2003","08","27"),
TUDate.convertToSql("2004","06","25"),
TUDate.convertToSql("2004","06","29"),
"NEW",
1,
new BigDecimal(0),
new BigDecimal(0),
null);
/* Add coverage rate object to array -- assume array only has one element for timebeing */
System.out.println("Setting arr in policyrate...");
prate.setRates(arr);
System.out.println("Creating array.sql.ARRAY for covrObj..");
prate.setRates(new oracle.sql.ARRAY(adesc,conn,covrObj));
System.out.println("Created array.sql.ARRAY for covrObj..");
/* Setup statemenet object */
cstmt = (OracleCallableStatement) conn.prepareCall("{call dbpckg_rate_obj.p_rate_obj_calc_rate(?)}");
/* Bind variables to statement */
System.out.println("Setting policyrate object...");
cstmt.setObject(1,prate,OracleTypes.STRUCT);
System.out.println("Registering out object...");
cstmt.registerOutParameter(1,oracle.jdbc.OracleTypes.STRUCT,PolicyRate._SQL_NAME);
cstmt.execute();
/* Retrieve the object back */
System.out.println("Getting policy rate object back...");
prate = (PolicyRate) cstmt.getObject(1);
System.out.println("Object Retrieved " + prate.getProductcode() + " " + prate.getAgentcode());
/* Close database connection */
conn.close();
catch (Exception exc) {
System.out.println("EXC: testPolicyRate(): " + exc);
exc.printStackTrace();
if (conn != null)
conn.close();
finally {
if (conn != null)
conn.close();
I've opened up a tar through metalink hopefully they can help get past this error...:)
Gurinder -
Oracle Database 2003 Beta Program: new JDBC/SQLJ/JPublisher features
We are currently recruiting for the Oracle Database 2003 Beta Program, including new JDBC/SQLJ/JPublisher features. To learn more about this program, including how to apply, send me an email @ [email protected]
Kuassi MensahI suppose that is nice.
It would be even nicer if the drivers actually conformed to JDBC so that one could for example reliably use blobs in a J2EE server with CMP. -
How to use LDB PNP with ABAP objects in a program
Hello,
I am wondering if anybody has used the HR logical database(LDB) PNP with user defined ABAP objects in a program? I am using the FM- <b>LDB_PROCESS</b> but its not working. Also assigning PNP in the attributes section of the program -- so that I can use predefined fields from the LDB and then invoking the FM doesn't work -- throwing 'Logical database already active' error.
I suppose even with the ABAP objects and the new FM -- I should still be able to utilize the pre-defined fields of the PNP database -- and also the built in authorizations. I cannot use GET PERNR and REJECT as they give errors. I understand that the use of HR-macros (RP-PROVIDE-FROM-LAST and et al.) are not allowed as they use the table work area -- which is not allowed in ABAP-OOPS.
I would really appreciate if anyone could show me some insight regarding this. Thank you.
Kshitij R. DevreHi Kshitij
It would be really good if we could use both together. But as I know, it is not possible. "GET pernr." is an event-like loop statement and so cannot be used in OO context. And I guess, the same restriction holds for the "LDB_PROCESS" since it uses LDB-specific processing.
What I suggest you is to use standard and BAPI functions.
Sorry for giving bad news...
*--Serdar -
Attach Documents to Custom Program Using Generic Object Services
Hi There,
I created Object type ZGOS and used in the custom program, when i try to attach documents it allows and then shows in attachment list.
But When I use that program next time that document attached is not available.
Is there any separate save Class or FM available for saving the document to the specified custom program.
I am using following code in the program,
CLEAR obj.
SET OBJECT TYPE TO 'ZGOS'
obj-objtype = objtype.
SET OBJECT KEY = REPORT NAME
SELECT SINGLE name
FROM trdir
INTO obj-objkey
WHERE name = sy-repid.
CALL GOS MANAGER WITHOUT CONTAINER (WILL BE DISPLAYED IN THE TOOLBAR)
CREATE OBJECT manager
EXPORTING
is_object = obj
EXCEPTIONS
OTHERS = 1.
Thanks in advance.Check the Naimesh Patel Blog he explain very well
http://help-abap.blogspot.com/2009/02/generic-object-services-gos-toolbar.html -
Screen Programming(Module Pool ) using Abap Objects
Hi gurus.,
I need to create a module pool program with tabstrips and tablecontrols using Abap objects...plz guide me how i can achieve this... i am very much confused.. i dont know how and where to start .. plz send me documents and sample codes related to this topic..Also hoe i can implement f4 help in screen fields..
Regards.,
S.SivakumarHi Sivakumar,
Go through the following links:
[url]http://www.savefile.com/download/156691?PHPSESSID=c49d6bed6630d830f3270f7eab51e547 [url]
[url]http://www.sapdb.info/category/sap-ebooks[url]
[url]http://sap.niraj.tripod.com/id25.html[url]
[url]http://abaplovers.blogspot.com/2008/03/sap-abap-tutorial-module-pool_17.html[url]
Thank you,
Prasad G.V.K
Edited by: Craig Cmehil on Jul 1, 2008 9:48 PM
Maybe you are looking for
-
Components don't show up in a purchased template
All, hopefully someone can help me. I'm still very new to designing in flash. I recently purchased a template because I liked the page flipping effect it had. However, I wanted to go in and modify the pages. Specifically, I wanted to place an imag
-
Hi All, I have noticed that after Submitting (Approving) a request, manager or role owner can still modify the user details (field are editable) like role validity date etc in a request. This is quite weird! Although, after submitting a request by a
-
Sale Orders per Characteristic values
Hello, Is there a SAP standart functionality for retrieving Sale Orders (or Sale Order Items) per characteristic values? Thanks
-
Will firmware 2.0 be included with iPod Touch if I buy one after 11th July?
I plan to buy an iPod Touch after 11th July (possibly this Sunday) and I was wondering if it will include the firmware 2.0 update. (I plan to buy it from an Apple store in the UK).
-
What happened if i check the property called Reentrant in SubVI's?
I am calling the SubVI called "Addition.Vi" from the Main VI two times. In first case i haven't checked the property Reentrant and i am executing the main program. So only one instance will be created and the SubVi's will be executed sequentially. In