Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to authenticate to the dB server, and specify the target database.

 
Treimin Clark
Ranch Hand
Posts: 757
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • Normally, we can use @Table annotation to mention the table name. But there may be several databases in the database provider (server). So, how can we mention the database name which contains our table?


  • If the database server (like MySQL) requires authentication, how we can specify the username and the password of the database?


  • If the database server is located in a remote machine (different IP), how can we specify the IP address to that database server?




  • All of the above requirements can be done by using the JDBC directly. But when JPA is used, I don't know how to do it. Please kindly provide any information about this. Is their any XML descriptors for this?
     
    Karnati Sudhakar
    Ranch Hand
    Posts: 270
    Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I guess if not all but some of those details will be entered in persistence.xml
     
    Hong Anderson
    Ranch Hand
    Posts: 1936
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    We specify which data source to use in persistence.xml. Properties of data source are specified outside JPA (for example, in JBoss we specify in *-ds.xml files).
     
    Treimin Clark
    Ranch Hand
    Posts: 757
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Kengkaj and Karnati.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic