Connecting to different schema while executing oracle scripts via Ant -
basically ant sql task following:
- deletes tables present in schemaa
- creates table schemaa
- deletes tables present in schemab
creates table schemab
<target name="exexcuteoracle"> <sql driver="oracle.jdbc.driver.oracledriver" url="jdbc:oracle:thin:@hostname:1521:orcl" userid="username" password="pass" print="yes"> <classpath> <pathelement location="${src.driversdir}/oracle/ojdbc6.jar" /> </classpath> <transaction src="${src.sqldir}/oracle/drop_tablesschemaa.sql" /> <transaction src="${src.sqldir}/oracle/create_tablesschemaa.sql" /> <transaction src="${src.sqldir}/oracle/drop_tablesschemab.sql" /> <transaction src="${src.sqldir}/oracle/create_tablesschemab.sql" /> <transaction src="${src.sqldir}/oracle/count_table_script.sql" /> </sql>
the problem "create_tablesschemab.sql" doesn't create tables schemab creates schemaa only. schemaa has tables. there script says connect schemaa or "connect schemaa"?
this because call not changing context 2nd schema
possible solutions be...
- if have thick oracle client on machine running ant script , tns-names set up, can connect inside sql script .. easier.
- create common task takes schema ant parameter ${}-- guess build properties -- avoid duplication main connection code-- , 2 tasks calling common task passing different schema names .. since there 2 tasks -- can use specific sql script there.
Comments
Post a Comment