Solved

App to Query MySQL via OLE

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Index not getting used in mysql query 2 42
mysql left join sentence 7 36
[MYSQL]: Delete is very slow 4 54
How many transactions can mysql handle? 3 22
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Creating and Managing Databases with phpMyAdmin in cPanel.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

15 Experts available now in Live!

Get 1:1 Help Now