On 6/28/11 11:28 AM, Phil Steitz wrote: > On 6/28/11 3:23 AM, Mirlan Ipasov wrote: >> Hi, Thank you for your replies. >> The thing is my server is not showing any Stack trace but only following >> exception . >> >> There was a SQL error while authenticating user [admin] >> >> I am using Eclipse Helios with tomcat7 is there anyway to see detailed stack >> trace? > Catch the AuthenticationException and dump its stack trace. See [1]. >> About using data source could you show me some example of using it with >> shiro? I searched it but no luck. > I have not tested this, but it looks to me like as long as the pool > has a bean interface for configuration, you should be able to just > specify the pooling datasource class name as the datasource property > and then specify its properties as dotted extensions. For example, > using Apache Commons DBCP (for other pools, consult the datasource > javadoc for property names): > > jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm > jdbcRealm.permissionsLookupEnabled = true > jdbcRealm.authenticationQuery = your query > jdbcRealm.userRolesQuery = your query > jdbcRealm.permissionsQuery = your query > > ds = org.apache.commoms.dbcp.BasicDataSource > ds.driverClassName = com.mysql.jdbc.Driver > ds.username = user name > ds.password = password > ds.url = connect URL > ds.maxActive = maximum number of connections > other properties, as documented in setter javadocs [2] > ... > jdbcRealm.datasource = ds
Sorry, above line should be jdbcRealm.dataSource = $ds Phil > If you choose to use Commons DBCP, make sure to download the latest releases > of Commons Pool and DBCP and add these jars to your application's classpath. > > Phil > > [1] http://shiro.apache.org/10-minute-tutorial.html > [2] http://s.apache.org/Q8m > > >> Thanking you, >> Mirlan >> >> >> >> >> On Tue, Jun 28, 2011 at 9:39 AM, Les Hazlewood <[email protected]>wrote: >> >>> Also, I wouldn't use the DataSource directly - use a connection pool >>> like BoneCPDataSource that uses the MySQL driver internally: >>> >>> http://jolbox.com/ >>> >>> I've been using it for a while with good results. >>> >>> HTH, >>> >>> Les >>> >>> On Mon, Jun 27, 2011 at 4:17 AM, Jared Bunting >>> <[email protected]> wrote: >>>> Well, on first glance your password field is different in your tables and >>> your query. That being said, it would probably be a bit easier to assist if >>> you pasted the full stacktrace. >>>> ipas <[email protected]> wrote: >>>> >>>> >>>> Hi, the problem above is resolved by changing following lines in web.xml >>> : >>>> ds = com.mysql.jdbc.Driver >>>> to >>>> ds = com.mysql.jdbc.jdbc2.optional.MysqlDataSource >>>> >>>> and i forget changing line coreFreightRealm.dataSource = $ds to >>>> jdbcRealm.dataSource = $ds >>>> >>>> >>>> Now my application is working but giving me *"here was a SQL error while >>>> authenticating user [admin]* ", But i can not understand exactly in which >>>> SQL query i have an error. >>>> >>>> my tables are : >>>> users(user_name varchar,user_pass varchar, status int), >>>> user_roles (user_name varchar,role_name varchar), >>>> roles_permissions(role_name varchar, permission varchar) >>>> >>>> Am i missing something? >>>> >>>> Thanking you, >>>> Mirlan >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>> http://shiro-user.582556.n2.nabble.com/Shiro-Jdbc-Realm-Mysql-tp6519616p6519975.html >>>> Sent from the Shiro User mailing list archive at Nabble.com.
