You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by dcominottim <da...@gmail.com> on 2014/01/24 19:54:17 UTC

How to set up a MySQL instance as an external data source in Shiro

Hello everybody,

Please, I would like to ask whether any book that deals solely with Shiro
and its best practices currently exists. Also, I have been searching for a
complete guide as to how to configure a MySQL DB instance as an external
data source/Realm. However, I have found but a few shiro.ini snippets here
and there, without too much info on the matter. Therefore, could you also
point me to any resources on this subject?

Thank you so much for your help and attention! 



--
View this message in context: http://shiro-user.582556.n2.nabble.com/How-to-set-up-a-MySQL-instance-as-an-external-data-source-in-Shiro-tp7579547.html
Sent from the Shiro User mailing list archive at Nabble.com.

Re: How to set up a MySQL instance as an external data source in Shiro

Posted by salihrkc <sa...@live.com>.
jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm

ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource
ds.serverName = localhost
ds.user = yourusername
ds.password = yourpassword
ds.databaseName = nameOfYourDatabase
jdbcRealm.dataSource= $ds

jdbcRealm.authenticationQuery = SELECT password from user where username = ?
#jdbcRealm.userRolesQuery = select role from userroles where userID =
(select id FROM user WHERE username = ?)



--
View this message in context: http://shiro-user.582556.n2.nabble.com/How-to-set-up-a-MySQL-instance-as-an-external-data-source-in-Shiro-tp7579547p7579549.html
Sent from the Shiro User mailing list archive at Nabble.com.