Search code examples
javamysqlapachespringibatis

How to manage read-only DB connections at an application level


We are using Java/Spring/Ibatis/MySql. Is there a way with these technologies to manage read-only connections at an application level. I am looking to add an extra layer of safeguarding on top of having read-only MySql users. It would be nice if BasicDataSource or SqlMapClientTemplate provided configuration for read-only connections. Otherwise, it seems like I'm left to only MySql read users and enforcing interfaces with only read methods.

Thanks


Solution

  • for example Connection#CreateStatement can takes parameters

    statement = connection.createStatement
    (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);