Re: Execute native SQL statements

Nikita Timofeev <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Message-ID <CAMi+qzBGcqKj17hjngDbKT-wePkzHK+7FB0o2P04ntZZduDvKQ@mail.gmail.com>
Hi,

You could use SQLExec to run generic SQL query:

SQLExec.query("SET ROLE browse_japan").execute(context);

See docs [1] for additional details.

[1] https://cayenne.apache.org/docs/4.1/cayenne-guide/#sqlselect-and-sqlexec

On Wed, Apr 8, 2020 at 8:18 AM Biswajeet Basumatary
<[email protected]> wrote:
>
> Hi ,
>
> How to execute the following statements in Cayenne. Trying to access Oracle schema using different account having select permission.
>
> SET ROLE browse_japan;
> ALTER SESSION SET CURRENT_SCHEMA = JAPAN;
>
> Regards,
> basu
>
>
> Note in JDBC I can execute the following it works
> .
> Connection connection = dataSource.getConnection();
> connection.createStatement().execute("SET ROLE browse_japan");
> connection.createStatement().execute("ALTER SESSION SET CURRENT_SCHEMA = JAPAN");



-- 
Best regards,
Nikita Timofeev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.