Alternative to Connector from getComponent - Mendix Forum

Alternative to Connector from getComponent

0

We are moving from 6.10.3 to Mendix 7. We have been using the following method to to get a connection to our database in Java actions.

Connection c = getComponent().connectionBus().getConnection();

It looks like the getComponent function was completely removed somewhere between the Mendix versions. I’d like to know if there are any other alternatives to get this connection similar to the getComponent method; without establishing a separate connection using the database URL or the Database Connector module.

asked
2 answers
2

If you take a look at the API docs, it seems the DataStorage class has what you are looking for,

answered
0
var ds=com.mendix.core.Core.dataStorage();
ds.executeWithConnection(
	function(a){
		try{
			var stmnt=a.prepareStatement(
			...

 

answered