Solved

App to Query MySQL via OLE

Posted on 2003-12-11
3
715 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

Title # Comments Views Activity
simple shopping cart database structure 5 101
CLI command keep running after close 7 56
Concat multiple records into one line 3 42
php hashing methods 3 12
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 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