Unitils和DBMaintainer - 如何让他们与多用户/模式工作? [英] Unitils and DBMaintainer - how to make them work with multiple users/schemas?

查看:289
本文介绍了Unitils和DBMaintainer - 如何让他们与多用户/模式工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个新的Oracle ADF项目,正在使用Oragle 10g数据库,而且我在使用Unitils和DBMaintainer在我们的项目为:

I am working on a new Oracle ADF project, that is using Oragle 10g Database, and I am using Unitils and DBMaintainer in our project for:


  • 更新数据库结构

  • 单元测试

  • 在种子数据读

  • 在测试数据读

  • 项目

在我们的项目,我们有2模式,和具有privilegies连接到这些架构2分贝用户。我让他们在增量名称的文件夹结构,我使用脚本命名的@convention。

In our project, we have 2 schemas, and 2 db users that have privilegies to connect to these schemas. I have them in a folder structure with incremental names and I am using the @convention for script naming.

001_@schemaA_name.sql 
002_@schemaB_name.sql 
003_@schemaA_name.sql 

这正常工作与蚂蚁和DBMaintainer更新任务,我通过配置额外的元素为Ant任务提供多个用户名。

This works fine with ant and DBMaintainer update task, and I supply the multiple user names by configuring extra elements for the ant task.

<target name="create" depends="users-drop, users-create" description="This tasks ... ">
    <updateDatabase scriptLocations="${dbscript.maintainer.dir}" autoCreateDbMaintainScriptsTable="true">
       <database name="${db.user.dans}" driverClassName="${driver}" userName="${db.user.dans}" password="${db.user.dans.pwd}" url="${db.url.full}" schemaNames="${db.user.dans}" />
        <database name="idp" driverClassName="${driver}" userName="${db.user.idp}"
            password="${db.user.idp.pwd}" url="${db.url.full}" schemaNames="${db.user.idp}" />
    </updateDatabase>
</target>

不过,我无法弄清楚,如何使DBMaintainer更新任务从我的数据库架构创建XSD模式?

However, I cant figure out, how to make the DBMaintainer update task create the xsd schemas from my db schemas?

所以,我决定使用Unitils,因​​为它的更新创建XSD架构。
我还没有发现对Unitils Ant任务的任何说明或说明文件 - 任何人都可以给一些提示吗?
暂时我也想通了,通过创建一个JUnit测试,与@Dataset注释运行Unitils。我可以把它与一个模式,一个数据库用户的工作。但我的想法如何使多个用户工作?

So, I decided to use Unitils, since its update creates xsd schemas. I haven't found any description or documentation for the Unitils ant tasks - can anyone give some hints? For the time being I have figured out to run Unitils by creating a Junit test, with @Dataset annotation. I can make it work with one schema, and one db user. But I am out of ideas how to make it work with multiple users?

下面是unitils-local.properties设置我有:

Here is the unitils-local.properties setup I have:

database.url=jdbc\:oracle\:thin\:@localhost\:1521\:vipu
database.schemaNames=a,b
database.userName=a
database.password=a1

可以任意你们的给我小费,如何使Unitils工作与第二个用户/模式?
我将是你的帮助非常gratefull!

Can any of you guys give me a tip, how to make Unitils work with the second user/schema ?? I will be extremely gratefull for your help!

推荐答案

我弄清楚如何使dbmaintain和unitils多数据库用户支持协同工作,但解决方案是一个纯粹的蚂蚁黑客。

I have figure out how to make dbmaintain and unitils work together on multi-database-user support, but the solution is a pure ant hack.


  1. 我已成立了dbmaintain配置,采用多数据库用户的支持。

  2. 我与令牌密钥的unitils-local.properties文件进行更换。

  3. 我的ant脚本的init目标生成新的文件unitils-local.properties,通过与正确目标envirnonment值替换令牌用户名/密码/模式,然后将其复制到用户的主目录。

  4. 我已经整理测试到文件夹中,与架构名称pfixed $ P $

  5. 当unitils被调用时,它拿起只是ant脚本创建的unitils-local.properties文件,并执行它的魔力。

其远pretty,但它的作品。

Its far from pretty, but it works.

这篇关于Unitils和DBMaintainer - 如何让他们与多用户/模式工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆