Solved

App to Query MySQL via OLE

Posted on 2003-12-11
3
708 Views
Last Modified: 2012-05-04
Hi,

We need to script an application for 3D Studio Max (MaxScript) that can query and update a MySQL database.  MaxScript does not have ODBC support :(, but it does allow us to send calls to other applications via OLE.  

My question is whether anyone can suggest a bare bones database query application which we could use to pass data to and from 3D Studio via OLE?

Maxscript can create and release OLE objects as in the following example:

ExcelApp = CreateOLEObject "excel.application"
ExcelApp.Visible = true
ExcelApp.Workbooks.Add()
ChartTypeVal = -4100
(ExcelApp.Range "a1").Value = 3
(ExcelApp.Range "a2").Value = 2
(ExcelApp.Range "a3").Value = 1

etc.

We just need a minimal application that will allow us to pass SQL queries to our MySQL database.   (We don't want to use Excel.)  

Thanks!

-Donald Newlands
0
Comment
Question by:donaldnewlands
  • 2
3 Comments
 
LVL 2

Expert Comment

by:holdenweb
ID: 9927835
I believe what you are referring to as "OLE objects" are really using what Microsoft nowadays call COM (Common Object Model) interface. This is good, as it means you can easily build the necessary solution yourself!

It's fairly easy to create a COM object - I'd use Python by choice, but you could just as easily use VB if that's what you're familiar with, or any other language supporting COM. The COM object you create can access MySQL using an ODBC driver when your Studio Max script calls its methods. So your new program will define a class whose methods will allow you to pass queries to MySQl, and returnt he results you want to see. You'll also need housekeeping methods to open a connection to the database, and close the connection before you destroy the object and terminate Studio Max.

Does this sound like something you'd be interested in? If so you might want to ask in the VB area for people to provide more detail (if you need it), but basically if you have Visual Studio you create an register a COM application of your own, and call its methods the same way as you access Excel functionality. I'd gladly give Python examples, but if you don't want to install Python that would be a waste of time :-)

In the application you envisage. Studio Max would be the "client" (the unit that raises the requests), and the new application (that accesses MySQL and returns the results) would be the "server".
0
 

Author Comment

by:donaldnewlands
ID: 9929570
Thanks -- I think that we will end up writing a VB application.  

In the meantime, is there a tool that we can use to list the methods exposed by applications that we have, and is there a query tool that you can recommend that might already expose some of that functionalilty?

-Donald
0
 
LVL 2

Accepted Solution

by:
holdenweb earned 250 total points
ID: 9931694
I can't think of anything like a class browser for COM objects - one of the problems is that COM is a very general interface, with dynamic possibilities, so complete interface discovery isn't always possible. The PythonWin utility has quite a good class browser, but you probably don't want to install Python just to get that.

Neither am I aware of a query tool, but it will be extremely simple to write one in any COM-capable language (C#, Visual C++, Visual Basic, Python, etc. etc.)./ Sorry I can't be more help, but maybe other readers can assist you with these point. Good luck!
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now