SQL Developer: BLOBs and the External Editor

thatjeffsmith SQL Developer 6 Comments

Tell Others About This Story:

We already know how easy it is to view images and plain text with the BLOB editor, yes?

But what if I have in my column a bunch of PDFs stored? I want to see that stuff without having to save the file, finding it, and then opening it.

Why can’t I just automatically open it directly from the database?

Well, it seems you can.

Here’s how.

External Editors

Step 1: Make sure you have the file types and associated editors defined in the preferences.

External editors available from the BLOB viewer

External editors available from the BLOB viewer

Based on what’s going on in your OS, you’ll have several of these already defined. If not, it’s pretty simple to add them manually.

Now, assuming you’ve got some fun data loaded up, let’s try it out.

A PDF

As you can see in the screenshot above, PDF is mapped to Adobe Reader.

I just happen to have a PDF loaded into a BLOB, let’s send it to the external editor.

Click on the hyperlinked text to load the PDF straight to Adobe

Click on the hyperlinked text to load the PDF straight to Adobe

Here’s it working in action (click on the image to see the animation):

If it's a big file, you will see a dialog where we're downloading the data.

If it’s a big file, you will see a dialog where we’re downloading the data.

Now if I were to edit said document and save it back to the database via the ‘Load’ mechanism, then we’ve come full circle.

Tell Others About This Story:

Comments 6

  1. if i have a blob containing an excel .xlsx file , sql*developer thinks its a .jar file.

    if i set .jar files to open with excel , excel complains the filetype doesnt match the name of .jar but it will then open if you force it too.

    is there anyway to make this nicer?

  2. Hi Jeff.
    I have a couple of questions about this subject.

    How can I add external editors in a “pretty simple” way? I suppose I can edit product-preferences.xml but I suspect that’s not the “pretty simple” way.

    How SQL Developer match a BLOB field with a mime type if there is not a mime type column o file extension? In your example, the BLOB is opened as a PDF document, but nothing, except DESCRIPTION content gives a clue about that.

    I have tried something similar with a binary file stored in a BLOB and SQL Developer shows an error about “Mime type not supported”:
    “The Mime Type of selected object is currently not supported. Please see the complete list of supported Mime Type and extension in Tools->Preferences->External Editor panel.”

    Best regards.

    1. thatjeffsmith Post
      Author

      don’t edit the preferences.xml, use the preferences dialog to define the external editors for the different mime types

      if there’s no match, there won’t be an external editor option

      you can’t add mime types, you can only supply editors for the mime types shown in the preferences dialog

        1. thatjeffsmith Post
          Author
          1. Hi Jeff

            Is it possible to submit a suggestion/request to add javascript as a mime type to the available mime types?

            Regards,
            Shaun

Leave a Reply

Your email address will not be published. Required fields are marked *