Connect to a MySQL database using LISP

Hi All

I would like to connect to a MySQL database using LISP. Is this possible? If not, is there another way?

Comments

  • Hi  Phil,

    have a look at the following sites :
    1.
    http://www.theswamp.org/index.php?topic=41438.msg465514#msg465514
    for a description of the matter.......
    ........There's a quick way of linking to/from lisp ... using a library called ADOLisp. As long as the database has an ADO or ODBC driver it would be trivial to link to such data store. Most windows installations come standard with at least DBF/MDB ODBC drivers - even if you don't have such program installed. So going that route might be the most broadly based alternative - i.e. you need not install extra programs to use your data..........
    2.
    getting the access autolisp library:
    http://acad.fleming-group.com/Download/ADOLisp/ADOLisp.html

    Basically you have to install the ODBC or ADO driver for MYSQL and then connect to the database
    using the functions of the library.
    Just read the documentation in the file Adolisp.pdf  included in the download package ADOlisp252.zip
    hope this helps !

    Regards
    Konstantin
  • Thanks Konstantin, will have a look.

    Should be useful as long as it doesn't rely on any windows specific software as I am using Linux as an OS.

    Regards Phill
  • Phill,

    Adolisp will not work on Linux (to the best of my knowledge) because two Windows specific technologies
    COM and ADO are required.
    Sorry the fault is on my side, i didn't notice that you posted in the Bricscad Linux Forum !

     Regards
    Konstantin


  •  If you absolutely need to I could think of the following kludge, but it sure ain't pretty:

    1. Write a program in Java or C which allows you to run the program with the SQL string as an argument (ie java whatever.jar "SELECT SOMETHING"). The java program then spits the output of the SQL command into a text file.
    2. Using LISP, run the java program with the SQL string as a parameter. Then parse the data in the text file.

    Again, this is NOT an example of good practice whatsoever but if you absolutely need database access, then go for it.
  • Did a bit more research will something like this work?

    (push #P"/usr/share/common-lisp/systems/" asdf:*central-registry*)
    (asdf:operate 'asdf:load-op 'clsql)
    (clsql:connect '("" "database_name" "user_name" "password") :database-type :mysql)
    (clsql-sys:query "SELECT * FROM table_name")
  • Hi Phill,

     

    I used the BRX API to build the SQLite wrappers for lisp. If you’re comfortable using C++, you can probably use the C/C++ interface for MySQL and build wrappers for lisp.  Here is a link to an old v12 version (sorry I have not kept it up to date for Linux)

     

    https://forum.bricsys.com/discussion/11607

    https://forum.bricsys.com/discussion/16442

     

    Anyway,  the source is available if you want to pilfer from it.

     

    Best

    Dan

  • Thanks Dan will have a look.

    Was hoping to avoid the whole brx/c++ thing. Although, I studied c++ At Uni, in the end put it in the too hard basket. But it looks like I might have to look at it again

    Thanks for your help
This discussion has been closed.