Sign in to follow this  
Followers 0
ChrisKozanecki

Using a CJ/CS to talk to a SQL database

5 posts in this topic

Ok, I have been looking for a clear answer, and even reading through old posts here via the search feature I am still not 100% clear. As the title says, I would like to know if its possible using a CJ or CS PLC with an ethernet module to talk directly to a networked SQL database. What I am looking to do is create a "smart conveyor" that will use an RVSI Hawkeye 1515 barcode reader to scan a part that is entering the conveyor. I then want it to talk to the same SQL database that the rest of the assembly line will talk to, and using the barcode it just received, determine if the part should be at the conveyor or if it should be elsewhere. I will then control what the conveyor does with the part (send it to the next station, or send the board to a reject area) I already have 90% of this project done on another conveyor, but this one would need to talk to the database. Is this possible with the ETN modules?? I know I can send strings from the DM or EM, but my work wont approve my PO's for parts unless I can find out before starting that I can do it from the PLC and not need a computer. Thanks in advance for your advice.

Share this post


Link to post
Share on other sites
How hard to do you want to work? Does your SQL database have an ODBC connection that accepts Ethernet socket services? Ethernet Socket Services will be your answer. After that, it is just a matter of placing the right SQL commands in DM and EM and sending them using Socket Services. The complete solution is not just in the PLC, but in the SQL server side also.

Share this post


Link to post
Share on other sites
I will ask my DBA... I know how to access the DB using C#, but they wanted me to see if I could do it with a PLC.

Share this post


Link to post
Share on other sites
Well, It seems that it does accept sockets. Apparently its the only way to connect to our database. I will look into it more. Anyone have any suggested places to read about it?

Share this post


Link to post
Share on other sites
Chris, There are standard FB's for opening / closing sockets, and also FB's for writing data once the socket is open. The documentation for these is included with CX-One. (FBs include Open, Close, Send, Receive for both TCP and UDP communications) 1. Open a Socket. (use FB) 2. Transmit / Receive data (use FB) 3. Close Socket. (Use FB) Have a look through the 'Construction of Applications Guide' for the ETN21 unit. This has a section on socket services. You will need some info about the database, ie the format of valid communications 'packets', port numbers etc. As Jay said, it should be as easy as building the communications data in DM/EM, and transmitting it to the database. Nibroc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0