Is it possible to create aapliaction in grails that works the way: User login with password and login to apliaction (authentication with spring security and postgredb), then aplication geting url to mongodb database (one per user), and then I configre application to use this db (with working mongo maped domain class)
grails, mongodb - multiple dbs
457 Views Asked by lukisp At
2
There are 2 best solutions below
1

Yes you can use Mongo and postgre both using following line of code in dataSource.groovy
development {
grails {
mongo {
host = "localhost"
username = ""
password = ""
databaseName = "schema_name"
}
}
dataSource_lookup {
dialect = 'org.hibernate.dialect.PostgreSQLDialect'
pooled = true
driverClassName = 'org.postgresql.Driver'
username = "postgres"
password = "admin"
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:postgresql://localhost:5432/schama_name?prepareThreshold=5&socketTimeout=5400"
}
}
If I am not wrong, you are asking about possibility of saving data in two data stores(Mongodb and Postgredb). In Postgredb, you want to store Spring Security authentication data and other application data in Mongodb.
Yes, this is possible. My current project had similar requirements and we are using MySQL and MongoDb.