I am able to connect to my default database. But added to that I also want to connect another database. I am using Play Framework 1.2.6. I know that this support is present in the main branch of Play 1.2.x. Can any one please help me, how I can achieve this in 1.2.6.
Thank you
Play 1.2.6 (or the 1.2.x branch) doesn't support multiple database connections out of the box. This support will be available in Play 1.3 which has not been released yet.
Here is the according ticket from the Play bug tracker:
http://play.lighthouseapp.com/projects/57987-play-framework/tickets/706
What database are you using? If your database supports multiple schemas you can achieve what you want by adding the following line on top of class.
@Entity
@Table(name="<table_name>",schema="<schema_2>")
public class xxx extends Model {
Entity and Table are part of the persistence api.
Found another interesting solution to your problem. Use below link if you need occasional access to the second database.
You can try to use this module : http://www.playframework.com/modules/multidb
Aj.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.