Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Inserting attribute values into MySQL

9 REPLIES 9
Reply
Message 1 of 10
aabfm
1101 Views, 9 Replies

Inserting attribute values into MySQL

Hi,

Does anyone know how to connect to MySQL database and insert data from a set of blocks containing attributes?

Something like:

 

block 1:

- x coordinate;

- y coordinate;

- handle;

 

block 2:

- x coordinate;

- y coordinate;

- handle;

 

block 3:

- x coordinate;

- y coordinate;

- handle;


I've just got the second part (retrieving info from the blocks), but when it comes to connect to the DB I'm completely lost.

For the DB I'm using XAMP for Windows, thus using localhost, user ('user123'), pass ('pass123') and table ('table123'). The table has ID (PriKey and AutoInc), px, py and hdl fields.

Thanks in advance.

9 REPLIES 9
Message 2 of 10
Hallex
in reply to: aabfm

See connection strings here:

http://connectionstrings.com/mysql

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 3 of 10
stevor
in reply to: aabfm

You may have to export that data as a text file and then 'import' it into the Xampp.

S
Message 4 of 10
aabfm
in reply to: stevor

That's what I've been doing... 😞

However, in order to make it more automated, I'd like acad to insert the data himself into de DB... 😉

Message 5 of 10
stevor
in reply to: aabfm

As you have neither posted any autocad code, not sql cod, I have no idea where you really are.

It may be possible to link to Xampp as can be done with Excel, etc,

and if that is posted here the try theswamp.org, or google.

 

The most probable 'automatic' means is still:

autolisp makes a file,

then activates a dos or windows script,

which loads it into Xampp.

S
Message 6 of 10
aabfm
in reply to: stevor

In one of my previous posts "Exporting multilayer objects"

 

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Exporting-list-of-objects/td-p/328363...

 

where Lee_Mac provided the solution, that's exactly what I've been doing: it exports several elements into a txt file and later on a PHP program retrieves the info from it and inserts it into a MySQL DB. That was realy good for the job I was doing at the time.

However, for the one I'm working on, I need pretty much the same but instead of putting the info into a txt file, I need AutoCAD to insert it directly into the DB, since I no longer need the PHP file to perform whatever it was doing at the time.

 

Message 7 of 10
stevor
in reply to: aabfm

If it is the connection side of the process, try that forum:

/discussion.autodesk.com/forum.jspa?forumID=16>

or something 'connectivity.'

 

Also, a 'Seach in this forum finds links.

S
Message 8 of 10
aabfm
in reply to: stevor

During my searches in this forum I found this post MySQL which might be the begining...

Now I just need to insert this code into Lee_Mac's and add some sort of INSERT MySQL command - my next step.

Message 9 of 10
stevor
in reply to: aabfm

Then you must have seen the post by, and of, Jon Fleming, like:

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Jon-Fleming-message-for/td-p/807824/p...

 

His site,  and free AdoLisp, are  still available.

http://www.fleming-group.com

 

S
Message 10 of 10
aabfm
in reply to: stevor

I'll give it a try

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost