Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 50221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:33:34+00:00 2026-05-10T16:33:34+00:00

I am using Oracle 9 and JDBC and would like to encyrpt a clob

  • 0

I am using Oracle 9 and JDBC and would like to encyrpt a clob as it is inserted into the DB. Ideally I’d like to be able to just insert the plaintext and have it encrypted by a stored procedure:

String SQL = 'INSERT INTO table (ID, VALUE) values (?, encrypt(?))'; PreparedStatement ps = connection.prepareStatement(SQL); ps.setInt(id); ps.setString(plaintext); ps.executeUpdate(); 

The plaintext is not expected to exceed 4000 characters but encrypting makes text longer. Our current approach to encryption uses dbms_obfuscation_toolkit.DESEncrypt() but we only process varchars. Will the following work?

FUNCTION encrypt(p_clob IN CLOB) RETURN CLOB IS     encrypted_string        CLOB;     v_string                CLOB; BEGIN   dbms_lob.createtemporary(encrypted_string, TRUE);   v_string := p_clob;   dbms_obfuscation_toolkit.DESEncrypt(     input_string => v_string,     key_string => key_string,     encrypted_string => encrypted_string );   RETURN UTL_RAW.CAST_TO_RAW(encrypted_string); END; 

I’m confused about the temporary clob; do I need to close it? Or am I totally off-track?

Edit: The purpose of the obfuscation is to prevent trivial access to the data. My other purpose is to obfuscate clobs in the same way that we are already obfuscating the varchar columns. The oracle sample code does not deal with clobs which is where my specific problem lies; encrypting varchars (smaller than 2000 chars) is straightforward.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:33:34+00:00Added an answer on May 10, 2026 at 4:33 pm

    I note you are on Oracle 9, but just for the record in Oracle 10g+ the dbms_obfuscation_toolkit was deprecated in favour of dbms_crypto.

    dbms_crypto does include CLOB support:

    DBMS_CRYPTO.ENCRYPT(    dst IN OUT NOCOPY BLOB,    src IN            CLOB         CHARACTER SET ANY_CS,    typ IN            PLS_INTEGER,    key IN            RAW,        iv  IN            RAW          DEFAULT NULL);  DBMS_CRYPT.DECRYPT(    dst IN OUT NOCOPY CLOB         CHARACTER SET ANY_CS,    src IN            BLOB,    typ IN            PLS_INTEGER,    key IN            RAW,    iv  IN            RAW          DEFAULT NULL); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the thin Oracle JDBC driver ver 10.2.0 (ojdbc14.jar). I would like
I am using Oracle 9 JDBC Thin Driver - the connection string I have
I am using Oracle SQL (in SQLDeveloper, using the SQL Worksheet). I would like
Im using sun.jdbc.odbc.JdbcOdbcDriver to connect to an oracle database.I know I would be probably
I am trying to connect to Oracle DB using JDBC. I have put ojdbc.jar
I am using Oracle SQL (in SQLDeveloper, so I don't have access to SQLPLUS
I have an application that's using Oracle.DataAccess to connect. I've already discovered that the
I would like to connect to a clustered Oracle database described by this TNS:
Using the JDBC driver oracle.jdbc.xa.client.OracleXADataSource, what is the correct format of the JDBC URL?
There is a way to specify IBatis query timeout using oracle jdbc and Java?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.