Re: SQL database and applescript?
Re: SQL database and applescript?
- Subject: Re: SQL database and applescript?
- From: email@hidden
- Date: Thu, 4 Apr 2002 11:29:45 -0500
Sorry for the lateness of this, but I figured I would throw it out there
just in case...
I too feel your pain. However, I've successfully used 2 methods for doing
SQL from AppleScript for free (or free if you own Microsoft Excel) with not
too much dependency on middleware (or at least middleware that's not already
likely to be around in a "Microsoft shop") for the last couple of years. For
instance, I have a script that uses Photoshop to save out JPEG versions of
print images, copies them to a server, and then updates our photo database
with info about each JPEG.
Basically, the methods I have used are:
1) Use Microsoft Excel for Mac. Set up a worksheet with a QueryTable to use
as the scriptable go-between for your script and the SQL database. Make sure
to install the "data access" components, and you'll need an ODBC driver for
your database. I used the one included with Office 98 for SQL Server, but
this was recently updated for SQl 7.0 and 2000 -- check
http://www.microsoft.com/mac/DOWNLOAD/OFFICE2001/XLDataAccess.asp.
Basically, you can change the SQL attribute of the QueryTable via
AppleScript, then tell the QueryTable to Refresh. This will execute your SQL
and return results into the area of the worksheet that display the
QueryTable. The downside with this approach is that you have to set up a DSN
on each Mac, I believe.
2) Use an ASP page on a local intranet server and communicate with it using
URL Access from your script. It's fairly easy to write a generic ASP page
that takes a SQL string as a form element and executes it against a database
server, returning the results as an HTML file. Your script then has to parse
that file to get any results you want back from the SQL server. But if it's
a small operation, this is pretty quick using file read/write commands. One
issue with this approach is security -- for the script to be able to post to
that ASP without user interaction, the ASP must be using an anonymous
account. Which means you're leaving an ASP out there on your intranet that
will blindly execute any SQL thrown at it. So make sure that the SQL login
that the ASP uses is relatively harmless to other data on your sever.
I can explain more if needed.
Jeff Sternberg
Crutchfield Corporation
http://www.crutchfield.com
>
Date: Sun, 31 Mar 2002 16:14:55 +0000
>
Subject: Re: SQL database and applescript?
>
From: Simon Topliss <email@hidden>
>
To: Applescript Mailing List <email@hidden>
>
>
Consider this a complete and utter begging email. I'd sell my grandmother
>
for an OSAX that can get SQL data from MS SQL 2000 Server without the need
>
for some relatively expensive middleware like MacSQL. This is a massive
>
project for us this year. We are still looking for some sort of solution
for
>
OS9 and OSX to enable us to get data from a SQL Server 2000 box into our
>
Adobe Illustrator artworks. This will run on about 80 macs so cost is a
>
major factor.
>
>
At the moment, the most cost effective solution is XML-RPC or SOAP as we
run
>
all the intranet, internet and databases on the very nasty MS Back Office.
>
Mainly because PC developers are easier to find and employ in the North of
>
England. Although I'm trying to push them towards a more mac compatible
>
solution from their end MySQL/PHP/Apache running on OSX.
>
>
If you require more info, please let me know off list
>
>
Simon Topliss
>
Systems Developer
>
Sonoco Trident
>
>
>
On 31/3/02 12:27 am, "Giuliano Gavazzi" <email@hidden> wrote:
>
>
> I don't know if an OSAX already exists to do so, but since I have
>
> experience with scriptable database clients (I support most
>
databases
>
> supported by OpenLink ODBC, but I once tested with the Merant ODBC
>
> suite and it worked too) I might be convinced to write an OSAX if
>
> enough persuasion is applied...
>
>
>
> Giuliano
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.