I have two projects (one project Referenced in the form of a jar package.jar project can be referenced by multiple projects). mybatis interface code is written in the jar project(common project). datebase properties at war project.
In the beginning, all the actual operations of the database were called in the war project, but now it is necessary to directly obtain the database data in the jar project Now I want to do query database operations in the jar project.how should i write? (Can I pass the interface class as a parameter into the jar project?)

I can only configure the database connection in the war project.What parameters should I pass to the jar project so that I can implement database query operations in the jar project.ask for advice!

20230410144912.png

I'm confused now how do I go about writing these codes

Place the database jar somewhere in your CLASSPATH, andimport the classes you need in the other projects do you can use them directly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.