shiro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: JdbcRealm + Postgresql
Date Thu, 18 Aug 2011 17:22:18 GMT
On 8/16/11 2:43 PM, Fabricio Pizzichillo wrote:
> Hi Les,
> I follow some docs, and write this in shiro.ini
>
>
> *[main]*
> *jdbcRealm* = org.apache.*shiro*.realm.jdbc.*JdbcRealm*
> *jdbcRealm*.authenticationQuery = "SELECT password FROM users WHERE
> user_name = ?"
> ds = org.Postgresql.Driver
> ds.serverName = IP
> ds.user = user
> ds.password = pass
> ds.databaseName = DATABASE
> jdbcRealm.dataSource = $ds
>
> But ds.serverName does not exist.
> I have to change anything?

Yes.  Those property names are for a MySQL JDBC datasource.  
Consult the documentation for the postgres JDBC driver that you are
using. Use a DataSource for ds (i.e. a postgres DataSource
implementation or a connection pool).  Then look at the properties
exposed by the DataSource implementation and define these using the
ds.xxx properties above.


Phil
> Thanks
>
> 2011/8/16 Les Hazlewood <lhazlewood@apache.org>
>
>> Hi Fabricio,
>>
>> Look at the JdbcRealm's implementation here:
>>
>>
>> http://svn.apache.org/repos/asf/shiro/trunk/core/src/main/java/org/apache/shiro/realm/jdbc/JdbcRealm.java
>>
>> and notice the *_QUERY constants.  For testing, you can make your
>> tables structured so that the queries will work for you.  But mostly
>> they are there as a default and to give you ideas.
>>
>> Usually, you will create database tables as necessary and call the
>> set*Query(String query) methods to match your database schema.
>>
>> HTH,
>>
>> --
>> Les Hazlewood
>> CTO, Katasoft | http://www.katasoft.com | 888.391.5282
>> twitter: @lhazlewood | http://twitter.com/lhazlewood
>> katasoft blog: http://www.katasoft.com/blogs/lhazlewood
>> personal blog: http://leshazlewood.com
>>


Mime
View raw message