Have you heard of the “File System Access API?” It allows for a web app to read and save changes directly to files and folders on your device.

If you think that sounds like it could be useful in say, SQL Developer Web, you’d be right!

In version 22.1 of SQL Dev Web, we can now access work with files through your browser, directly on your machine.

This would be much different than say, upload a file to ORDS on the webserver…doing work…and maybe downloading it back once we were done.

This API is not universally adopted by all browsers, yet. So users on these platforms/versions should be ‘good to go.’

Source: developer.mozilla.org, as of 10 June 2022.

I’m on Chrome Version 102.0.5005.63, so I’m definitely in the ‘Full Support’ window.

Let’s give it a go!

Wait, a couple more requirements

You need to have a SECURE website, that is..SSL. OR, you need to be on ‘localhost‘ – so running ORDS on the same machine as the files you’re going to be accessing via SQL Developer Web.

I’m doing a mix of both for these screenshots/GIFs.

In the worksheet

Instead of navigating the contents of the schema, we can see our work via the ‘Files’ panel. That will show both worksheets we’ve saved in our browser, and FILEs we’ve granted the webpage to have read/write access to.

Click the ‘Open file’ button.

From here you’ll get either Windows Explorer or Mac’s Finder…or whatever your OS uses to navigate the file system. You’ll pick a file or folder…

Mmmmm, tasty employees.

We’ll then read the file directly off the machine. This is different than UPLOADING the file to ORDS.

I can now make some changes to the file…and SAVE it.

Don’t ask me what I think about this keyword for VIEWs and PL/SQL.

If I were to open the same file in my favorite text editor/IDE, I’d see the file exactly as shown in my worksheet!

Security Settings and Permissions

You may be asked for access when you go to open the file, but you’ll definitely be asked for permission when you go to SAVE the file.

That’ll look something like this –

View file, yes.

And also this –

Save changes, yes.

If this isn’t working for you, you may want to check your browser engine, version, and security settings.

I can’t remember but I think I had this set to ‘Can ask’ to true by default.

Being able to open/write to files is kind of a big deal.

We foresee the other browsers getting there eventually. In the meantime, we’ll have other places in the application to take advantage of this feature.

For example, it would be nice to read the contents of a CSV file directly off your machine vs uploading it perhaps when we IMPORT data to a table?

Stay tuned!

thatjeffsmith
Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

Write A Comment

RSS
Follow by Email
LinkedIn
Share