Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Eclipselink nosql with MongoDB Atlas(Find JPA persistence unit settings to connect to MongoDB Atlas)
Eclipselink nosql with MongoDB Atlas [message #1858333] Wed, 29 March 2023 10:08
Marcus B. is currently offline Marcus B.Friend
Messages: 1
Registered: March 2023
Junior Member
I would like to connect to my Atlas cluster using eclipselinks nosql feature. I manage to connect to a local mongodb using this persistance.xml:

    <persistence-unit name="mongo-test" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <properties>
            <property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/>
            <property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/>
            <property name="eclipselink.nosql.property.mongo.port" value="27017"/>
            <property name="eclipselink.nosql.property.mongo.host" value="localhost"/>
            <property name="eclipselink.nosql.property.mongo.db" value="xrn-testing"/>
            <property name="eclipselink.logging.level" value="FINEST"/>
        </properties>
    </persistence-unit>
</persistence>


However from Atlas I just get a connection string which looks like this:

mongodb+srv://<user>:<password>@test-cluster-0.xxxx.mongodb.net/?retryWrites=true&w=majority


Question: How do I need to set up my persistence.xml to connect to the cluster. In particular:

- what's the port? Is it still 27017? Do I need to provide it at all?
- is test-cluster-0.xxxx.mongodb.net the correct host? What about the query string?
- how to correctly include user name and password?

Or does anybody have an example persistence.xml for an Atlas cluster?
Previous Topic:Spring Transactions with ecliplink jpa
Next Topic:Ping test failed error
Goto Forum:
  


Current Time: Mon Jan 20 20:17:46 GMT 2025

Powered by FUDForum. Page generated in 0.02486 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top