473,765 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

global temporary table --> invalid ROWID?

Hi,

I am creating a global temporary table that is session-specific. I
insert a BLOB into this table, and then select the BLOB from this
table into a ResultSet. The ResultSet sees this BLOB object, and I am
able to get the binary input stream from this blob. However, when I
invoke InputStream.rea d(byte[]) on this input stream, I get the
following exception:

java.io.IOExcep tion: ORA-01410: invalid ROWID
ORA-06512: at "SYS.DBMS_L OB", line 751
ORA-06512: at line 1
at oracle.jdbc.dba ccess.DBError.S QLToIOException (DBError.java:6 25)

at oracle.jdbc.dri ver.OracleBlobI nputStream.need Bytes(OracleBlo bInputStream.ja va:179)

at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:113)

at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:91)
...

Just for clarity, here is basically the code I'm using:

CallableStateme nt cstmt2 = db.prepareCall( "commit");
CallableStateme nt cstmt = db.prepareCall( "create global temporary
table temp_table (blobid NUMBER unique, blob_col BLOB) on commit
preserve rows");
cstmt.execute() ;
cstmt.close();
cstmt2.execute( );
CallableStateme nt cstmt1 = db.prepareCall( "insert into temp_table
values (1, empty_blob())") ;
cstmt1.execute( );
cstmt1.close();
cstmt2.execute( );
cstmt2.close();

CallableStateme nt plsqlblock =
db.prepareCall( stringThatFills InEmptyBlobInTe mpTable);
plsqlblock.exec ute();
plsqlblock.clos e();

PreparedStateme nt pstmt1 = db.prepareState ment("select blob_col from
temp_table where blobid = 1");
ResultSet rset = pstmt1.executeQ uery();
BLOB bl;
if (rset.next())
{
System.out.prin tln("success.") ; //<--- This prints out.
bl = ((OracleResultS et)rset).getBLO B(1);
}
pstmt1.close();

InputStream bis = bl.getBinaryStr eam();
int numBytes = 0;
byte[] theBytes = new byte[appropriateLeng th];
numBytes = bis.read(theByt es); ///*******EXCEPTIO N HAPPENS
HERE!!!!
I would also like to mention that when I change temp_table to be just
a regular table, everything works correctly.

What's the problem, and how do I fix it?

Thanks,

Corrine
Jul 19 '05 #1
4 13740
Reason as per my understanding: java front end would be using
connection pooling, and the session is not bound. so once the back end
proc gives the output back to front end, and then the front end tries
to access the blob stored in the global temp table, it will give
error, as global temp table is session specific. (so rowid not found).
Same type of errors would be encountered with ref cursors based on
global temp tables.
So, don't use Global Temporary tables for returning resultsets to java
front end.
Hope this helps.

Ja***********@v olcanomail.com (Corrine) wrote in message news:<54******* *************** ****@posting.go ogle.com>...
Hi,

I am creating a global temporary table that is session-specific. I
insert a BLOB into this table, and then select the BLOB from this
table into a ResultSet. The ResultSet sees this BLOB object, and I am
able to get the binary input stream from this blob. However, when I
invoke InputStream.rea d(byte[]) on this input stream, I get the
following exception:

java.io.IOExcep tion: ORA-01410: invalid ROWID
ORA-06512: at "SYS.DBMS_L OB", line 751
ORA-06512: at line 1
at oracle.jdbc.dba ccess.DBError.S QLToIOException (DBError.java:6 25)

at oracle.jdbc.dri ver.OracleBlobI nputStream.need Bytes(OracleBlo bInputStream.ja va:179)

at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:113)

at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:91)
...

Just for clarity, here is basically the code I'm using:

CallableStateme nt cstmt2 = db.prepareCall( "commit");
CallableStateme nt cstmt = db.prepareCall( "create global temporary
table temp_table (blobid NUMBER unique, blob_col BLOB) on commit
preserve rows");
cstmt.execute() ;
cstmt.close();
cstmt2.execute( );
CallableStateme nt cstmt1 = db.prepareCall( "insert into temp_table
values (1, empty_blob())") ;
cstmt1.execute( );
cstmt1.close();
cstmt2.execute( );
cstmt2.close();

CallableStateme nt plsqlblock =
db.prepareCall( stringThatFills InEmptyBlobInTe mpTable);
plsqlblock.exec ute();
plsqlblock.clos e();

PreparedStateme nt pstmt1 = db.prepareState ment("select blob_col from
temp_table where blobid = 1");
ResultSet rset = pstmt1.executeQ uery();
BLOB bl;
if (rset.next())
{
System.out.prin tln("success.") ; //<--- This prints out.
bl = ((OracleResultS et)rset).getBLO B(1);
}
pstmt1.close();

InputStream bis = bl.getBinaryStr eam();
int numBytes = 0;
byte[] theBytes = new byte[appropriateLeng th];
numBytes = bis.read(theByt es); ///*******EXCEPTIO N HAPPENS
HERE!!!!
I would also like to mention that when I change temp_table to be just
a regular table, everything works correctly.

What's the problem, and how do I fix it?

Thanks,

Corrine

Jul 19 '05 #2
"Oracle_Technet " <or************ @yahoo.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com...
Reason as per my understanding: java front end would be using
connection pooling, and the session is not bound. so once the back end
proc gives the output back to front end, and then the front end tries
to access the blob stored in the global temp table, it will give
error, as global temp table is session specific. (so rowid not found).
Same type of errors would be encountered with ref cursors based on
global temp tables.
So, don't use Global Temporary tables for returning resultsets to java
front end.
Hope this helps.

Ja***********@v olcanomail.com (Corrine) wrote in message

news:<54******* *************** ****@posting.go ogle.com>...
Hi,

I am creating a global temporary table that is session-specific. I
insert a BLOB into this table, and then select the BLOB from this
table into a ResultSet. The ResultSet sees this BLOB object, and I am
able to get the binary input stream from this blob. However, when I
invoke InputStream.rea d(byte[]) on this input stream, I get the
following exception:

java.io.IOExcep tion: ORA-01410: invalid ROWID
ORA-06512: at "SYS.DBMS_L OB", line 751
ORA-06512: at line 1
at oracle.jdbc.dba ccess.DBError.S QLToIOException (DBError.java:6 25)

at oracle.jdbc.dri ver.OracleBlobI nputStream.need Bytes(OracleBlo bInputStream.ja v
a:179)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:113)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:91) ...

Just for clarity, here is basically the code I'm using:

CallableStateme nt cstmt2 = db.prepareCall( "commit");
CallableStateme nt cstmt = db.prepareCall( "create global temporary
table temp_table (blobid NUMBER unique, blob_col BLOB) on commit
preserve rows");
cstmt.execute() ;
cstmt.close();
cstmt2.execute( );
CallableStateme nt cstmt1 = db.prepareCall( "insert into temp_table
values (1, empty_blob())") ;
cstmt1.execute( );
cstmt1.close();
cstmt2.execute( );
cstmt2.close();

CallableStateme nt plsqlblock =
db.prepareCall( stringThatFills InEmptyBlobInTe mpTable);
plsqlblock.exec ute();
plsqlblock.clos e();

PreparedStateme nt pstmt1 = db.prepareState ment("select blob_col from
temp_table where blobid = 1");
ResultSet rset = pstmt1.executeQ uery();
BLOB bl;
if (rset.next())
{
System.out.prin tln("success.") ; //<--- This prints out.
bl = ((OracleResultS et)rset).getBLO B(1);
}
pstmt1.close();

InputStream bis = bl.getBinaryStr eam();
int numBytes = 0;
byte[] theBytes = new byte[appropriateLeng th];
numBytes = bis.read(theByt es); ///*******EXCEPTIO N HAPPENS
HERE!!!!
I would also like to mention that when I change temp_table to be just
a regular table, everything works correctly.

What's the problem, and how do I fix it?

Thanks,

Corrine


If it works on a regular table then why are you making things more expensive
by putting it in a temp table first? Just get it out of the regular table.
Jim
Jul 19 '05 #3
Is a temporary table really more expensive than a regular table?
Actually, I prefer a temporary table, because my application serves
multiple users simultaneously. I am concerned about concurrency
issues that arise if I use
just a regular table.

Speaking of which, what if I use a temporary BLOB rather than a
temporary table? I am trying to do this now, but I can't figure out
how to get the modified BLOB object back to Java after the PLSQL block
has finished executing.

I do:

BLOB bl = BLOB.createTemp orary(db,true,B LOB.DURATION_SE SSION);
CallableStateme nt plsqlblock = conn.prepareCal l(
"declare\n" +
" stuff... \n"+
"begin\n"+
" procThatModifie sBLOB(?);\n"+
"end;\n");
plsqlblock.setB lob(1, bl);
plsqlblock.exec ute();

bl = plsqlblock.getB lob(1); //**** doesn't work.

How do I retrieve the modified value of "bl" after "plsqlblock "
finishes executing?
"Jim Kennedy" <kennedy-down_with_spamm ers@no_spam.com cast.net> wrote in message news:<Pxffb.485 819$Oz4.329946@ rwcrnsc54>...

If it works on a regular table then why are you making things more
expensive
by putting it in a temp table first? Just get it out of the regular table.
Jim "Oracle_Technet " <or************ @yahoo.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com...
Reason as per my understanding: java front end would be using
connection pooling, and the session is not bound. so once the back end
proc gives the output back to front end, and then the front end tries
to access the blob stored in the global temp table, it will give
error, as global temp table is session specific. (so rowid not found).
Same type of errors would be encountered with ref cursors based on
global temp tables.
So, don't use Global Temporary tables for returning resultsets to java
front end.
Hope this helps.

Ja***********@v olcanomail.com (Corrine) wrote in message

news:<54******* *************** ****@posting.go ogle.com>...
Hi,

I am creating a global temporary table that is session-specific. I
insert a BLOB into this table, and then select the BLOB from this
table into a ResultSet. The ResultSet sees this BLOB object, and I am
able to get the binary input stream from this blob. However, when I
invoke InputStream.rea d(byte[]) on this input stream, I get the
following exception:

java.io.IOExcep tion: ORA-01410: invalid ROWID
ORA-06512: at "SYS.DBMS_L OB", line 751
ORA-06512: at line 1
at oracle.jdbc.dba ccess.DBError.S QLToIOException (DBError.java:6 25)

at oracle.jdbc.dri ver.OracleBlobI nputStream.need Bytes(OracleBlo bInputStream.ja v
a:179)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:113)
at oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:91) ...

Just for clarity, here is basically the code I'm using:

CallableStateme nt cstmt2 = db.prepareCall( "commit");
CallableStateme nt cstmt = db.prepareCall( "create global temporary
table temp_table (blobid NUMBER unique, blob_col BLOB) on commit
preserve rows");
cstmt.execute() ;
cstmt.close();
cstmt2.execute( );
CallableStateme nt cstmt1 = db.prepareCall( "insert into temp_table
values (1, empty_blob())") ;
cstmt1.execute( );
cstmt1.close();
cstmt2.execute( );
cstmt2.close();

CallableStateme nt plsqlblock =
db.prepareCall( stringThatFills InEmptyBlobInTe mpTable);
plsqlblock.exec ute();
plsqlblock.clos e();

PreparedStateme nt pstmt1 = db.prepareState ment("select blob_col from
temp_table where blobid = 1");
ResultSet rset = pstmt1.executeQ uery();
BLOB bl;
if (rset.next())
{
System.out.prin tln("success.") ; //<--- This prints out.
bl = ((OracleResultS et)rset).getBLO B(1);
}
pstmt1.close();

InputStream bis = bl.getBinaryStr eam();
int numBytes = 0;
byte[] theBytes = new byte[appropriateLeng th];
numBytes = bis.read(theByt es); ///*******EXCEPTIO N HAPPENS
HERE!!!!
I would also like to mention that when I change temp_table to be just
a regular table, everything works correctly.

What's the problem, and how do I fix it?

Thanks,

Corrine


Jul 19 '05 #4
"Corrine" <Ja***********@ volcanomail.com > wrote in message
news:54******** *************** ***@posting.goo gle.com...
Is a temporary table really more expensive than a regular table?
Actually, I prefer a temporary table, because my application serves
multiple users simultaneously. I am concerned about concurrency
issues that arise if I use
just a regular table.

Speaking of which, what if I use a temporary BLOB rather than a
temporary table? I am trying to do this now, but I can't figure out
how to get the modified BLOB object back to Java after the PLSQL block
has finished executing.

I do:

BLOB bl = BLOB.createTemp orary(db,true,B LOB.DURATION_SE SSION);
CallableStateme nt plsqlblock = conn.prepareCal l(
"declare\n" +
" stuff... \n"+
"begin\n"+
" procThatModifie sBLOB(?);\n"+
"end;\n");
plsqlblock.setB lob(1, bl);
plsqlblock.exec ute();

bl = plsqlblock.getB lob(1); //**** doesn't work.

How do I retrieve the modified value of "bl" after "plsqlblock "
finishes executing?
"Jim Kennedy" <kennedy-down_with_spamm ers@no_spam.com cast.net> wrote in message news:<Pxffb.485 819$Oz4.329946@ rwcrnsc54>...
If it works on a regular table then why are you making things more
expensive
by putting it in a temp table first? Just get it out of the regular table.
Jim

"Oracle_Technet " <or************ @yahoo.com> wrote in message
news:c3******** *************** ***@posting.goo gle.com...
Reason as per my understanding: java front end would be using
connection pooling, and the session is not bound. so once the back end
proc gives the output back to front end, and then the front end tries
to access the blob stored in the global temp table, it will give
error, as global temp table is session specific. (so rowid not found).
Same type of errors would be encountered with ref cursors based on
global temp tables.
So, don't use Global Temporary tables for returning resultsets to java
front end.
Hope this helps.

Ja***********@v olcanomail.com (Corrine) wrote in message

news:<54******* *************** ****@posting.go ogle.com>...
> Hi,
>
> I am creating a global temporary table that is session-specific. I
> insert a BLOB into this table, and then select the BLOB from this
> table into a ResultSet. The ResultSet sees this BLOB object, and I am > able to get the binary input stream from this blob. However, when I
> invoke InputStream.rea d(byte[]) on this input stream, I get the
> following exception:
>
> java.io.IOExcep tion: ORA-01410: invalid ROWID
> ORA-06512: at "SYS.DBMS_L OB", line 751
> ORA-06512: at line 1
>
>
> at oracle.jdbc.dba ccess.DBError.S QLToIOException (DBError.java:6 25)
>
> at

oracle.jdbc.dri ver.OracleBlobI nputStream.need Bytes(OracleBlo bInputStream.ja v a:179)
>
> at

oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:113)
>
> at

oracle.jdbc.dri ver.OracleBuffe redStream.read( OracleBufferedS tream.java:91)
> ...
>
> Just for clarity, here is basically the code I'm using:
>
> CallableStateme nt cstmt2 = db.prepareCall( "commit");
> CallableStateme nt cstmt = db.prepareCall( "create global temporary > table temp_table (blobid NUMBER unique, blob_col BLOB) on commit
> preserve rows");
> cstmt.execute() ;
> cstmt.close();
> cstmt2.execute( );
> CallableStateme nt cstmt1 = db.prepareCall( "insert into temp_table > values (1, empty_blob())") ;
> cstmt1.execute( );
> cstmt1.close();
> cstmt2.execute( );
> cstmt2.close();
>
> CallableStateme nt plsqlblock =
> db.prepareCall( stringThatFills InEmptyBlobInTe mpTable);
> plsqlblock.exec ute();
> plsqlblock.clos e();
>
> PreparedStateme nt pstmt1 = db.prepareState ment("select blob_col from > temp_table where blobid = 1");
> ResultSet rset = pstmt1.executeQ uery();
> BLOB bl;
> if (rset.next())
> {
> System.out.prin tln("success.") ; //<--- This prints out.
> bl = ((OracleResultS et)rset).getBLO B(1);
> }
> pstmt1.close();
>
> InputStream bis = bl.getBinaryStr eam();
> int numBytes = 0;
> byte[] theBytes = new byte[appropriateLeng th];
> numBytes = bis.read(theByt es); ///*******EXCEPTIO N HAPPENS
> HERE!!!!
>
>
> I would also like to mention that when I change temp_table to be just > a regular table, everything works correctly.
>
> What's the problem, and how do I fix it?
>
> Thanks,
>
> Corrine



You don't need a temporary table. In Oracle readers don't block readers or
writers and writers don't block readers. This type of programming is often
seen in SQLServer because of the lack of concurrency. Using a regular table
you will not see concurrency issues in Oracle.
Jim
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
33656
by: Jim Garrison | last post by:
Scenario: 1) Create a GLOBAL TEMPORARY table and populate it with one (1) row. 2) Join that table to another with about 1 million rows. The join condition selects a few hundred rows. Performance: 4 seconds, the system is doing a full-table scan of the second table, and the Explain Plan output
2
3388
by: Yannick Turgeon | last post by:
Hello all, I'm using SS2K on W2K. Brieffing: Many months ago, I created a stored procedure only used by those with admin rights in SS. Now, someone else (without admin rights) has to run it. I gave him rigth to execute the SP but, at the second and more execution, he got a error message concerning a temp table already existing (see further).
3
3457
by: vsaraog | last post by:
Hi everybody, I asked the following question but didn't get any reply. If anyone knows something about the problem, then please reply since I am really in a bind. Here is the question... I am using a Created Global Temporary Table in DB2 OS/390 version 7.1.2 with "ON COMMIT DELETE ROWS". The DBA says that I they don't have the option of "ON COMMIT PRESERVE ROWS" for Created Global Temp. tables. Anyway... I am inserting some data in...
7
2311
by: fintudet | last post by:
Hello. During some experimentation with DB2 decimal numbers representations, I have discovered very unexpected behaviour of the global temporary table. Consider this example. Such I had executed the example: # db2 -td@ -f FILENAME. When an single Insert into table fails, the table gets empty. Could anybody shed some light on this ?
2
4139
by: chettiar | last post by:
I am creating a procedure A which is creating a global temporary table DECLARE GLOBAL TEMPORARY TABLE session.temp (Service CHAR(2), CustomerServiceTypeId INTEGER) WITH REPLACE ON COMMIT PRESERVE ROWS; I am able to compile the proceudre. But when I try to compile procedure B which is referencing the temporary table in procedure A, I get the error.
1
13514
by: Kburton | last post by:
Is it possible to create a temporary table and fill it with data in single declare statement? Example: Declare global temporary table session.tmp1 AS (select tid,fid,name from <table> where tid in (select tid,name from <table>)). This results in an error indicating db2 was expecting the 'definition only' token. If I add the 'definition only' token to the statement it works. I thought the AS clause would allow me to create the...
5
8839
by: Rahul B | last post by:
Hi, I have very little knowledge about creating Procedures/functions in DB2. When i tried to create the test function like CREATE FUNCTION GET_TEST (P_TEST_ID INTEGER, P_SEL_OR_SORT INTEGER,
1
1869
by: Ragianand | last post by:
Hi All, I have created a stored procedure which populates a global emporary table...Now i want to write a function which returns a view that contains the data from the global temporary table.Can anyoune suggest a solution for this...Any sample code to return a view from a function with data from a global temporary table in another procedure. My understanding is that global temporary table will loose the data once we exit the procedure and...
4
466
by: Corrine | last post by:
Hi, I am creating a global temporary table that is session-specific. I insert a BLOB into this table, and then select the BLOB from this table into a ResultSet. The ResultSet sees this BLOB object, and I am able to get the binary input stream from this blob. However, when I invoke InputStream.read(byte) on this input stream, I get the following exception: java.io.IOException: ORA-01410: invalid ROWID
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.