Hi everyone, I am trying to connect to a mysql database on my Hostgator web server
I followed the instruction in this link:
However, i encounter the following errors:
Runtime error (OdbcException): ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.
ERROR [01000] [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect()).
ERROR [01S00] [Microsoft][ODBC SQL Server Driver]Invalid connection string attribute
The following is my code:
import clr
import System
clr.AddReference(“System.Data”)
from System.Data import DataSet
from System.Data.Odbc import OdbcConnection, OdbcDataAdapter
connectString = (“DRIVER={SQL Server};”
“SERVER=xxx.xxx.xxx.xxx;”
“PORT=3306;DATABASE=mydb;”
“UID=root;”
“PWD=’’;”
“OPTION=3;”)
query = “SELECT * FROM users”
connection = OdbcConnection(connectString)
adaptor = OdbcDataAdapter(query, connection)
dataSet = DataSet()
connection.Open()
adaptor.Fill(dataSet)
connection.Close()
7 posts - 2 participants