i given credentials, appear missing here, script errors out when trying make 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 mysql database') try: sql_command = "select * test test '%fileuploadagent%' , status='00' order test desc;" cur.execute(sql_command) db.commit() rows = cur.fetchall() row in rows: print " ", row[1][1] except: print "did not work" db.close()
i provided following credentials: host, user, passwd, driver, jdbc.url, port
in sql script there using driver or jdbc.url. these 2 things , required make database connection. why unable connect?
you may need check if remote database allowed connect remotely.