简体   繁体   English

如何将JBOSS数据源设置为Oracle数据库,使用与用于身份验证的模式不同的模式

[英]How can I set a JBOSS data source to an Oracle database use a different schema to the one used for authentication

I have a Java webapp (WAR) that is to be run in JBOSS. 我有一个要在JBOSS中运行的Java Webapp(WAR)。

That webapp is to create connections to an Oracle database using a username/password for a user that is given read-only permissions. 该webapp将使用具有只读权限的用户名/密码来创建与Oracle数据库的连接。

The webapp queries tables belonging to a different schema. webapp查询属于不同架构的表。 I do this by qualifying each table name in my SQL queries. 我通过限定SQL查询中的每个表名来做到这一点。

However, I would like to parameterise this in my datasource, since the schema names can be different in different environments. 但是,我想在我的数据源中对此进行参数化,因为架构名称在不同的环境中可以不同。

Is there a way to define a JBOSS data source which logs in as User A for each connection, but uses Schema B for all queries? 有没有一种方法可以定义一个JBOSS数据源,该数据源以每个连接的用户A身份登录,但使用模式B进行所有查询?

一种方法是使用new-connection-sqlcheck-valid-connection-sql 数据源属性执行ALTER SESSION SET CURRENT_SCHEMA=yourschema ,这将更改每个连接的默认架构。

推荐的方法是在Oracle中为用户A创建同义词,以访问用户B拥有的架构中的表。通过这种方式,您甚至可以授予用户A特定的特权,以选择,更新,插入另一个UserB拥有的表。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在jboss 6.2中添加Oracle数据源 - How to add Oracle data source in jboss 6.2 如何将表数据从一个模式复制到另一模式中名称不同的表? - How can I copy table data from one schema to a table of a different name in a different schema? 如何在Oracle上使用Pentaho模式工作台? - How can I use Pentaho schema workbench on Oracle? 我如何确定数据源的Oracle数据库名称 - how do i determine oracle database name of data source 耳文件中的jboss 5.0数据源配置。 如何在同一服务器上运行oracle 10g和11g? - jboss 5.0 data source configuration in ear file. How can I run oracle 10g and 11g on the same server? Oracle:如何有效地将表从一种模式复制到另一台数据库和服务器上的另一种模式 - Oracle: How to efficiently copy a table from one schema to another on a different database and server 在 Oracle 数据库中,我可以跟踪访问同一架构的不同个人的登录吗? - In Oracle database, can I track logins of different individuals who access the same schema? 我们可以使用在Oracle数据库的另一模式中的一个模式中定义的表空间吗? 如果是,请告诉我方法 - Can we Use tablespace defined in one schema in another schema Of Oracle Database. If Yes, Please let me know the method 我可以在 oracle 的一个联合子句中使用不同的提示吗 - can I use different hints in one clause of union in oracle 如何将数据从旧模式数据库迁移到具有不同数据库连接的新模式 - How do I migrate data from my old schema database to New schema with different database connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM