I was given some credentials, but I appear to be missing something here, as the script errors out when trying to make a connection.
import mysql.connector
def test_sql_query():
db = mysql.connector.connect(host='hostname', database='db', user='dbuser,' password='dbpass', port='000')
cur = db.cursor()
if db.is_connected():
print('Connected to MySQL database')
try:
sql_command = "select * from test where test like '%FileUploadAgent%' and status='00' order by test desc;"
cur.execute(sql_command)
db.commit()
rows = cur.fetchall()
for row in rows:
print " ", row[1][1]
except:
print "did not work"
db.close()
I was provided with the following credentials: host, user, passwd, driver, jdbc.url, port
In my sql script there is nowhere that I am using driver or jdbc.url. What are these two things and are they required to make a database connection. Is this why I am unable to connect?