Create database connection on gateway from module

imaget
Is it possible to create a database connection that falls under the Config > Database > Database Connections on module setup. I can see there is a GatewayContext.createDataSource() function but not sure if that is what I want here.

No, not in any supported way.

It will be possible in 8.3, though not really an explicitly recommend pattern.

But we can access the datasource using the DatasourceManager from the GatewayContext right? Which allows us to query the database or insert to the database.

Yes, modules are allowed/expected to use already configured database connections. We just haven't ever really supported machine configuration of a gateway.