473,554 Members | 2,826 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 13687
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
33613
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
3369
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...
3
3435
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...
7
2295
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
4110
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...
1
13355
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...
5
8802
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
1859
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. ...
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...
0
7499
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...
0
8013
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...
0
7862
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...
0
6120
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...
1
5414
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...
0
5136
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...
0
3530
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1994
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
0
814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.