Solved

App to Query MySQL via OLE

Posted on 2003-12-11
3
716 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
[X]
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
  • 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

I use MySQL for many of my development projects in a Windows environment. To manage my databases (and perform queries) for years I used a tool called MySQL administrator.  This tool has since been replaced by MySQL Workbench. So I decided to m…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

710 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