Grasshopper

algorithmic modeling for Rhino

Anyone know how to connect to an Access database from VB in GH?

Also, has anyone tried connecting to internet-based SQL databases? For example, if I have MySQL running on a web server, and I want to issue SQL commands and get recordsets back?

Thanks!

Views: 1161

Replies to This Discussion

This mostly depends if the database is stored on the local machine, or on a server somewhere.
If it's the first case, you just need a connector, for example shown here.
If you are querying something far, then you have many choices. One is to setup one answer protocol from a specific page on the server that will actually then perform the query by itself.
You could use PHP, Ruby, Python, or .Net itself on the server (depending on what it supports) to perform the query. They will have their own method to connect to the database, which might be on the same server or another one.

- Giulio
_____________
giulio@mcneel.com
McNeel Europe, Barcelona
Thanks for the reply to the other URL post. I was just trying that out. So say I used that code to talk to a server. I write some PHP to do the query, which is no problem. So now I'm wondering about the format of the response from the PHP page. When talking directly to databases, I'm used to getting recordset objects back. I don't need that kind of object, but really just one that acts like one (has rows with named fields and values). If I could receive XML, then I could parse that, but surely there is something existing to turn XML into some kind of object instead of writing the parsing code myself.

In the past, I've used ODBC connections to talk to far off databases. Like using Access just because it is an easy client for working directly on a database. I'd really like to take input from a web-based database and plug that into GH. Not even sure why yet. Just feel like it would be fun.
If your database is on an accessible server, and the implementation is listening on some port, you could connect also directly to the remote database. Probably this is something more firewalls would be blocking. But there are examples using MySql, too. Have a look at this connector here.

Otherwise, sure, one method is to receive some XML flavor. There are many methods here, and I do not know them all very well either. But there is an XMLSerializer in .Net. You can see its reference here. A more abstract persistence model might be for example based on NHibernateforNET. See this question, too.

- Giulio
_____________
giulio@mcneel.com
McNeel Europe, Barcelona
Hello Chris, I know some people here in BCN that have connected to mysql. DUMO. The connecton is straightforward, but how to maintain and utilize the data is another question...

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service