lundi 5 octobre 2015

same schema different database (ower) skip?

In legacy code I have something like this..

String q = "select RESULT from usr_dba.CONTEXT where CONTEXT_ID = ?"

    Connection dbc = null;
    PreparedStatement pst = null;
    ResultSet rs = null;
try{
    dbc = DataSourceUtils.getConnection(dataSource);
    pst = dbc.prepareStatement(q);
    pst.setLong(1, id);
    rs = pst.executeQuery();
    if (rs.next()) {
    boolean r = rs.getLong("RESULT");
}...

Nothing too crazy... What I wanted to do is to write tests to cover the code like this. Except the database we used to test is H2 (in memory, and fast) and the actual database in production is oracle. The problem is when we hits user group like "usr_dba." H2 says syntax error. I was wondering if there are ways to by pass owner.

In local (namespace) we have defined schema for H2 which match up with oracle. Constraints, sequences, etc. The only thing that isnt in H2 is the owner, since it is for testing we dont think we need it. But now this issue occurs so I was wondering if owner could also be added in H2? When I read the documentation for H2 I cannot find adding owner to it. Maybe H2 does not support it?

Aucun commentaire:

Enregistrer un commentaire