Re: MySQL and Arduino Chapter 7
I appreciate the feedback for the book. However, I should not answer questions concerning the book on this forum. But since it is related to the connector, allow me to explain...
The Ethernet.begin() method has several variants:
Ethernet.begin(mac);
Ethernet.begin(mac, ip);
Ethernet.begin(mac, ip, dns);
Ethernet.begin(mac, ip, dns, gateway);
Ethernet.begin(mac, ip, dns, gateway, subnet);
You must choose one of these to initiate the Ethernet class. As you can see, you must specify a MAC address for all variants.
DHCP is initiated with the first variant. In order to use this form, you must have a DHCP server running on your network. Otherwise, you will need to setup the Ethernet class with a static IP address. Which is what the other variants permit. The IP address in the last four are the IP address of your Arduino board.
With regard to the connector itself, you must specify the following items when connecting to the server:
- server IP address (the server where MySQL is being hosted)
- server PORT where MySQL is listening
- user name
- password
Example:
my_conn.mysql_connect(server_addr, port, user, password)