dbcapoeira, SQL via HTTP, SQLDev

Can I run SQL Scripts via HTTP?

I saw this question via Twitter not to long ago, and then it came up again in a brief conversation with +Bobby Curtis, and it was about running SQL scripts over HTTP.  So if you are interested, here is a quick post on how to do just that.

Say you have a ton of extremely useful scripts on your site, like +Kellyn Pot’Vin‘s site http://dbakevlar.com/?  Would it be a neat idea if you could put those somewhere on the Internet where you or anyone for that matter could run them by just knowing the URL?  Maybe?  Maybe Not?  Anyway here’s my test.

For this “demo”, I’m using #SQLDev 4.0 because I like the application. Thanks +Jeff Smith .  You can also use SQL Plus for this.  Here is a simple example:

Connect to your database and execute the following

SELECT 2+2 as “Sum” from dual;

Simple enough right?  Suppose you needed this powerful script, and you couldn’t remember it, or just didn’t feel like typing all of this again.  Everyone’s been there before.  Build your script library on your web site and reference it from there.  Give it a try.

Now that I have done this, let’s see what happens.  Open SQLDev and try this: (Check out this use of the floating windows feature in  SQLDev).


Simply execute as you would any other, directing it to the “web address” of the desired script.  Now as you can see, it may take a bit longer to execute:  .002s (local) vs .004s (remote), but it works.

I haven’t tested this out on any DDL, but I suspect that if you have been granted the appropriate privileges on the database, they would work as well, and whether or not to do something like this at all …. well that is up to you.  Enjoy!! 

Related Posts Plugin for WordPress, Blogger...

1 Comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.