0

In Mule 3, I can get the database connection using the following Java code snippet:

StaticDbConfigResolver staticDBConfig = org.mule.RequestContext.getEventContext().getMuleContext().getRegistry().lookupObject("Oracle_Configuration");
MuleEvent muleEvent = org.mule.RequestContext.getEvent();
GenericDbConfig genericDBConfig = (org.mule.module.db.internal.domain.database.GenericDbConfig)staticDBConfig.resolve(muleEvent);
Connection connection = genericDBConfig.getDataSource().getConnection();

How can I achieve the same in Mule 4 ?

I tried searching in Google, but I am not able to find anything.

Thanks, Sunny

1 Answer 1

0

The short answer is no. The internals of Mule 4 connectors are not exposed to applications. The design doesn't allow for custom Java code to access the connections nor any other implementation details. See https://docs.mulesoft.com/mule-sdk/latest/isolation#modules-classloading-isolation for more details.

Instead I recommend to ask a new question about the specific problem for which you are trying to get the connection to see if it could be implemented using Mule 4 features.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.