Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

App to Query MySQL via OLE

Posted on 2003-12-11
3
714 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

840 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