Standalone connections in TypeORM versions greater than 0.3.0

101 views Asked by At

In the TypeORM versions smaller than 0.3.0 you could create normal connections:

const createdConnection: Connection = await createConnection(options);

And then, this connection was usable like this:

MyModel.useConnection(connection);

And the connection could be closed without any problems after the database tasks were complete:

connection.close();

I´ve never had any issues regarding connection pooling in previous versions of typeorm. But since the 0.3.0 update (now i´m on 0.3.7) i´m constantly getting the error

Pool is closed

It seems to me, that the datasource type does not act independently anymore, like the connection type did in the previous versions.

Is there a way to get this behaviour back?

0

There are 0 answers