Create a Datasource with GatewayContext.createDataSource(Properties connectionProps)

How do I create a new datasource with GatewayContext.createDataSource(Properties connectionProps) ?

Can I have an example? Does this also create a DatasourceRecord so that users can edit the connection in the Gateway UI?

Thanks

No, that method isn’t what you’re thinking. It’s not creating a "datasource " like Ignition’s concept of a datasource. It’s creating a javax.sql.DataSource - a source of JDBC connections. It only exists because our JDBC drivers are in a separate classloader and so the gateway needs to do some gymnastics in order to create jdbc driver instances correctly.

There is no reason you should be calling it, it probably shouldn’t be part of the public API.

1 Like