Search code examples
dartfluttersqljocky

Exception when connecting to Database through Dart


I was trying to connect to MySQL database in Flutter application using sqljocky5 using the below code using dart language

void getInfo () async {
    var pool = new ConnectionPool(
        host: 'localhost',
        port: 3305,
        user: 'root',
        password: 'mysql',
        db: 'smartlender',
        max :5
    );
    print('test');
    var results = await pool.query('SELECT employee.firstName  FROM smartlender.employee;'); // exception is thrown here
    results.forEach((row){  // for each loop to add data to the list created above
      names.add(row[0].toString());
    }); 

Then I received this exception: I have working connection to MySQL database and the query is exiting without an error . I appreciate a lot if someone could resolve this issue .


Solution

  • Isn't it default Mysql port number 3306?