Hi guys,
I want to connect Grasshopper to MySQL database. I want to have the outcome of a sqlquery as output of the GhPython component.
import clr
clr.AddReference('System.Data')
from System.Data import *
TheConnection = SqlClient.SqlConnection("Server=localhost\\phpMyAdmin,3306;database=w43_anchors_towing_moong_equipment;trusted_connection=True")
TheConnection.Open()
MyAction = SqlClient.SqlCommand("SELECT File_path FROM w43 WHERE Weight BETWEEN 40 AND 80 ORDER BY Name", TheConnection)
MyReader = MyAction.ExecuteReader()
while MyReader.Read():
print MyReader[0]
MyReader.Close()
TheConnection.Close()
This what i have now. Python gives the following Error:
Runtime error (SqlException): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 0 - An established connection was aborted by the software in your host machine.)
*Traceback:*
*line 7, in script*
I have tried to change the servername in multiple ways, change the trustedconnection to a password and a username. I checked the query in MySQL and it works fine.
Really hope u can help me guys! Thanks in advance.