File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
main/java/org/utplsql/sqldev/dal
test/java/org/utplsql/sqldev/tests Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 17
17
18
18
import java.sql.Connection
19
19
import java.util.List
20
+ import org.springframework.dao.DataAccessException
20
21
import org.springframework.dao.EmptyResultDataAccessException
21
22
import org.springframework.jdbc.core.BeanPropertyRowMapper
22
23
import org.springframework.jdbc.core.JdbcTemplate
@@ -33,6 +34,20 @@ class UtplsqlDao {
33
34
this . jdbcTemplate = new JdbcTemplate (new SingleConnectionDataSource (conn, true ))
34
35
}
35
36
37
+ def boolean isDbaViewAccessible () {
38
+ try {
39
+ val sql = ' ' '
40
+ SELECT 1
41
+ FROM dba_objects
42
+ WHERE 1=2
43
+ ' ' '
44
+ jdbcTemplate. execute(sql)
45
+ return true
46
+ } catch (DataAccessException e) {
47
+ return false
48
+ }
49
+ }
50
+
36
51
/**
37
52
* Gets the schema name of the utPLSQL installation.
38
53
*
@@ -42,7 +57,7 @@ class UtplsqlDao {
42
57
def String getUtplsqlSchema () {
43
58
val sql = ' ' '
44
59
SELECT table_owner
45
- FROM all_synonyms
60
+ FROM «IF dbaViewAccessible»dba«ELSE»all«ENDIF»_synonyms
46
61
WHERE owner = ' PUBLIC '
47
62
AND synonym_name = ' «UTPLSQL_PACKAGE_NAME »'
48
63
AND table_name = ' «UTPLSQL_PACKAGE_NAME »'
Original file line number Diff line number Diff line change @@ -35,7 +35,15 @@ class DalTest extends AbstractJdbcTest {
35
35
} catch (BadSqlGrammarException e) {
36
36
// ignore
37
37
}
38
- }
38
+ }
39
+
40
+ @Test
41
+ def void isDbaViewAccessible () {
42
+ val dao = new UtplsqlDao (dataSource. connection)
43
+ Assert . assertFalse(dao. dbaViewAccessible)
44
+ val sysDao = new UtplsqlDao (sysDataSource. connection)
45
+ Assert . assertTrue(sysDao. dbaViewAccessible)
46
+ }
39
47
40
48
@Test
41
49
def void utplsqlSchema () {
You can’t perform that action at this time.
0 commit comments