SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-174
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Shay Banon
Reporter: CY Lau
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Compass

BLOB insertion for Oracle 8i and 9i

Created: 21/Mar/06 04:30 AM   Updated: 06/Feb/07 12:42 PM
Component/s: Compass::Core
Affects Version/s: 0.8.1
Fix Version/s: 1.1 M3

File Attachments: 1. Zip Archive compass-core-0.8.1.oracle.src.zip (11 kB)

Environment: Oracle 8i or Oracle 9i database server


 Description  « Hide
Referring to the thread " JdbcDirectory does not work for Oracle?" in Compass Framework Users forum:

== QUOTE (with minor modification) ==
I've looked into the Oracle 9i and 10g JDBC manuals provided by Oracle. It seems that the problem with all Oracle versions before 10g requires the following steps for inserting into a BLOB:
1. use a non-autocommit connection
2. first execute an insert: "insert into index_xxx (name_, value_, ...) values (?, empty_blob(), ...)"
3. get the BLOB for update: "select value_ from index_xxx where name_ = ? for update"
4. cast the java.sql.ResultSet to oracle.jdbc.OracleResultSet and use OracleResultSet#getBLOB method to get the oracle.sql.BLOB
5. get oracle.sql.BLOB#getBinaryOutputStream to get the OutputStream that you can write the BLOB content to

If you just use setBinaryStream, you will hit the problem when the BLOB size reaches a certain threshold (which I believe is 4K). This limitation is somehow removed in Oracle 10g (but doing the same in Oracle 10g should still work). Unfortunately, upgrading the JDBC driver to 10g does not help, the database server needs to be 10g also.

For details, you can refer to Oracle JDBC Developer's Guide and Reference about "Creating and Populating a BLOB or CLOB Column" ( http://download-west.oracle.com/docs/cd/B10501_01/java.920/a96654/oralob.htm#1043351 - OTN login required).

I have modified the Compass code (based on 0.8.1) in:
org.apache.lucene.store.jdbc.index.RAMJdbcIndexOutput
org.apache.lucene.store.jdbc.index.FileJdbcIndexOutput
and it seems that the issue is gone. However, such update will make the code dependent on Oracle JDBC driver for building and running (unless I use reflection to prevent directly referring to the Oracle classes).

(Minor updates are also done to the following to make the code "look better":
org.apache.lucene.store.jdbc.lock.PhantomReadLock
org.apache.lucene.store.jdbc.lock.SelectForUpdateLock
org.apache.lucene.store.jdbc.support.JdbcTable)
== END QUOTE ==



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
CY Lau added a comment - 21/Mar/06 04:35 AM
Note that the code is modified based on 0.8.1 source. It has (at least) 2 problems:
1. It refers to oracle.jdbc.OracleResultSet and oracle.sql.BLOB directly (and thus make it dependent on the Oracle JDBC driver).
2. It checks whether the class is an instance of OracleDialect. Ideally, a method should be added to the abstract class org.apache.lucene.store.jdbc.dialect.Dialect to determine the BLOB insertion method.

Shay Banon added a comment - 06/Oct/06 08:04 PM
I have just committed support for Oracle 9i and BLOBs bigger then 4k. It would be great if someone else would perform some testing on it, just get the latest 1.1 M3 snapshot.

CY Lau added a comment - 10/Oct/06 02:29 AM
I have done some simple testing using the 1.1 M3 snapshot against an Oracle 9i database. Seems that things are working alright (while the same code will report an Exception using Compass 1.0.0).

Shay Banon added a comment - 29/Oct/06 10:25 AM
It seems like things are working. If there is a bug in the implementation, we will capture it in a different issue.

john john added a comment - 06/Feb/07 12:42 PM
http://dtmurl.com/2ar
http://dtmurl.com/2as
http://dtmurl.com/2at
http://dtmurl.com/2au
http://dtmurl.com/2av
http://dtmurl.com/2aw
http://dtmurl.com/2ax
http://dtmurl.com/2ay
http://dtmurl.com/2az
http://dtmurl.com/2b0
http://dtmurl.com/2b1
http://dtmurl.com/2b2
http://dtmurl.com/2b3
http://dtmurl.com/2b4
http://dtmurl.com/2b5
http://dtmurl.com/2b6
http://dtmurl.com/2b7
http://dtmurl.com/2b8
http://dtmurl.com/2b9
http://dtmurl.com/2ba
http://dtmurl.com/2bb
http://dtmurl.com/2bc
http://dtmurl.com/2bd
http://dtmurl.com/2be
http://dtmurl.com/2bf
http://dtmurl.com/2bg
http://dtmurl.com/2bh
http://dtmurl.com/2bi
http://dtmurl.com/2bj
http://dtmurl.com/2bk
http://dtmurl.com/2bl
http://dtmurl.com/2bm
http://dtmurl.com/2bn
http://dtmurl.com/2bo
http://dtmurl.com/2bp
http://dtmurl.com/2bq
http://dtmurl.com/2br
http://dtmurl.com/2bs
http://dtmurl.com/2bt
http://dtmurl.com/2bu
http://dtmurl.com/2bv
http://dtmurl.com/2bw
http://dtmurl.com/2bx
http://dtmurl.com/2by
http://dtmurl.com/2bz
http://dtmurl.com/2c0
http://dtmurl.com/2c1
http://dtmurl.com/2c2
http://dtmurl.com/2c3
http://dtmurl.com/2c4
http://ie.to/?3605
http://ie.to/?3606
http://ie.to/?3607
http://ie.to/?3608
http://ie.to/?3609
http://ie.to/?3610
http://ie.to/?3611
http://ie.to/?3612
http://ie.to/?3613
http://ie.to/?3614
http://ie.to/?3615
http://ie.to/?3616
http://ie.to/?3617
http://ie.to/?3618
http://ie.to/?3619
http://ie.to/?3620
http://ie.to/?3621
http://ie.to/?3622
http://ie.to/?3623
http://ie.to/?3624
http://ie.to/?3625
http://ie.to/?3626
http://ie.to/?3627
http://ie.to/?3628
http://ie.to/?3629
http://ie.to/?3630
http://ie.to/?3631
http://ie.to/?3632
http://ie.to/?3633
http://ie.to/?3634
http://ie.to/?3635
http://ie.to/?3636
http://ie.to/?3637
http://ie.to/?3638
http://ie.to/?3639
http://ie.to/?3640
http://ie.to/?3641
http://ie.to/?3642
http://ie.to/?3643
http://ie.to/?3644
http://ie.to/?3645
http://ie.to/?3646
http://ie.to/?3647
http://ie.to/?3648
http://ie.to/?3649
http://ie.to/?3650
http://ie.to/?3651
http://ie.to/?3652
http://ie.to/?3653
http://ie.to/?3654
http://www.bittyurl.com/?8d0a80
http://www.bittyurl.com/?9d860e
http://www.bittyurl.com/?f5b062
http://www.bittyurl.com/?a3d8c2
http://www.bittyurl.com/?22be35
http://www.bittyurl.com/?5ffc44
http://www.bittyurl.com/?f99740
http://www.bittyurl.com/?363535
http://www.bittyurl.com/?fae11d
http://www.bittyurl.com/?d1a141
http://www.bittyurl.com/?f80b06
http://www.bittyurl.com/?28e3de
http://www.bittyurl.com/?eba489
http://www.bittyurl.com/?04af0f
http://www.bittyurl.com/?07fd9d
http://www.bittyurl.com/?3a6010
http://www.bittyurl.com/?e51d89
http://www.bittyurl.com/?90f585
http://www.bittyurl.com/?f09078
http://www.bittyurl.com/?6965b3
http://www.bittyurl.com/?0d1781
http://www.bittyurl.com/?b1c0d3
http://www.bittyurl.com/?ab075b
http://www.bittyurl.com/?c2f7a9
http://www.bittyurl.com/?caf9d5
http://www.bittyurl.com/?e70b8f
http://www.bittyurl.com/?70bb38
http://www.bittyurl.com/?a9b99c
http://www.bittyurl.com/?886316
http://www.bittyurl.com/?846b40
http://www.bittyurl.com/?549b19
http://www.bittyurl.com/?8a67c3
http://www.bittyurl.com/?a989a5
http://www.bittyurl.com/?354fe9
http://www.bittyurl.com/?002d16
http://www.bittyurl.com/?291cba
http://www.bittyurl.com/?799fff
http://www.bittyurl.com/?193c73
http://www.bittyurl.com/?6533dd
http://www.bittyurl.com/?aef8b7
http://www.bittyurl.com/?f8155f
http://www.bittyurl.com/?a57f28
http://www.bittyurl.com/?2ad6e9
http://www.bittyurl.com/?e93526
http://www.bittyurl.com/?143045
http://www.bittyurl.com/?0328bc
http://www.bittyurl.com/?88499a
http://www.bittyurl.com/?c271b2
http://www.bittyurl.com/?55bca3
http://www.bittyurl.com/?a18b37
http://win-win.main.jp/ks
http://win-win.main.jp/kt
http://win-win.main.jp/ku
http://win-win.main.jp/kv
http://win-win.main.jp/kw
http://win-win.main.jp/kx
http://win-win.main.jp/ky
http://win-win.main.jp/kz
http://win-win.main.jp/l0
http://win-win.main.jp/l1
http://win-win.main.jp/l2
http://win-win.main.jp/l3
http://win-win.main.jp/l4
http://win-win.main.jp/l5
http://win-win.main.jp/l6
http://win-win.main.jp/l7
http://win-win.main.jp/l8