[Closed] Maxscript and MySQL
Hi,
I am trying to connect a maxscript to a mysql database.
I tried a python comserver approach ( here ). It worked on a previous computer but now I can’t get it to work.
And I found this tutorial to connect max with mysql. Problem is I have trouble installing the mysql connector. So I downloaded the dll and tried to call it from max and I get this error :
-- Runtime error: dotNet runtime exception:
An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework.
This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous.
If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch.
See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
Is anyone have a solution to this problem or have onther way to connect to mysql from maxscript ?
Thanks,
Johanna
As the topic is maked as resolved maybe not good to bother you but if still looking for alternative, as in previous topic, I’ll again recommend ADODB, as there is many resources online on how to work with it.
Here is the startup steps, just as future reference
(complete example can post only if someone interested about):
-- create an instance of the ADO connection and recordset objects
Connection = createOLEObject "ADODB.Connection"
Recordset = createOLEObject "ADODB.Recordset"
-- define the connection string, specify CORRECT database driver
ConnString = "DRIVER={[b]MySQL ODBC 3.51 Driver[/b]}; " +
"SERVER=localhost; DATABASE=Your_MySQL_DB; " +
"UID=mysql_username;PWD=mysql_password; OPTION=3"
-- open the connection to the database
Connection.Open ConnString
Actually never mind. Almost as soon as I posted this question I installed the previous version of mysql-connector and it works perfectly fine.
Sorry if you lost your time reading it !
This is an error message you get when you try to load a .dll you downloaded from the internet. Windows sandboxes these dlls. Before loading them, you must open the file properties of what you downloaded and press ‘unlock’.
Thanks, that’s always interesting to have an alternative.
Since you seem to prefer the ADODB connection, what would you say are its advantages / differences compared to dotNet connection ?
Well… this need large reply but will try to make it short
Yes, I see some benefit of using ADODB in this case (MySQL).
Maybe first s’d note that my contact with DB is for client-side solutions (not server-side yet), and in .Net I use OLEDB, while ADODB call mainly form VBScript. If I need SQL server then probably will use MS SQL that come with Visual Studio anyway and will access it with SqlOleDb provider.
Also s’d repeat that am not dig enough in that direction (MySQL) and I presume you use the method shown into Zelichover’s tutorial, i.e. I choose from 2 known to me solutions. Maybe there’s more (and better) ways to connect to MySQL from .Net but comparing both I’ll prefer OLE objects.
Well, I see 2 things here and will mark first the minor of them as its more short to explain. Using OLE objects made the script backward compatible, allow the script running on old Max’s (where not .Net support). Of course this is not an issue if you code for the recent Max versions.
But the major (at least to me) drawback using .Net (in this case) is the memory leak. (this is a long story). If loading the MySQL connector driver is the only way to access your database via .Net, then I’ll choose OLE connection.
[Note to the .Net-lovers – Don’t eat me, please! DotNet rocks!] (:
Thanks for the explanations.
I started to use the dotNet connector, and I don’t really have time to dig into the other direction. But ‘ill think of it if I have to write another program