Thread

Posted on Thu May 8 21:08:07 2008 by fosterj2
Inserting LOBs
I am having an issue inserting a record into an Oracle table using some Perl code I wrote. The table contains a CLOB field. The user account that I am connecting to Oracle with has limited rights to the table. I had initially granted INSERT rights to the table, which I get back a message stating I have insufficient privileges. After a lot of searching, I found that when dealing with LOBs that I had to grant UPDATE privileges as well due to how DBI/DBD-Oracle handles LOBS. So I granted that privilege as well and still no luck. For some reason I have to grant SELECT privileges to the table as well as the INSERT and UPDATE privileges. Being that Perl is clear text code, I created this limited privilege account since the username and password are exposed. I would prefer to not grant SELECT privileges on the table if possible as an additional security precaution. Is there some way to insert CLOBs without granting SELECT privileges to the table?
Direct Responses: 7840 | Write a response
Posted on Thu May 8 22:58:16 2008 by byterock in response to 7838
Re: Inserting LOBs
I think you are suffering from a common miconception of Lob fields. Blob and Clob fields do not contain the data per say they just contain a LOB locator wich points to the data someplace else. (Not sure where actullay I think it differs from Oracle version to Version ) So if you want to update a lob you will first need the lob locator (select) then get the lob (select kind of) and then Update. At least that is what is going on behind the sceans in DBD::Oracle (OCI) If you want that sort of control over the user then wrap your insert in a procedure and then grant that use only use of that procedure. This would be the SQL work around for this. If you have Oracle 10.2 or greater and DBD 1.21 you can use prisistant lobs and bypass lob locators all together. you might want to they the lob read write and append functions as well but I think you need crud access to use them as well
Write a response