Showing posts with label Create table. Show all posts
Showing posts with label Create table. Show all posts

Using the StartSQLRepository - Beginners IV

StartSQLRepository can be used for following activites,
  1. Verifing the Data Defination XML is correctly formed and complies with the DTD.
  2. Generating the SQL Statements to create tables.
  3. Import the data into DB (Supports both versioned and non-versioned) and exporting the data.
Points 1 and 2 are covered as part of scope. Point 3 will be covered in coming up topics.

Steps for generating DDL using the  StartSQLRepository.


1.    Shut down all the nucleus instances running in machine.(JBOSS, JUNIT)
2.    Create the following folder structure(if not present).
                       <DYNAMO_HOME>\home\localconfig\atg\dynamo\service\jdbc
3.    Create JTDataSource.properties under jdbc folder and place the following content into file.
                        dataSource=/atg/dynamo/service/jdbc/FakeXADataSource
4.    Create FakeXADataSource.properties under jdbc folder and place the following content into file.
$class=atg.service.jdbc.FakeXADataSource
#Below contents vary according the DB
driver=oracle.jdbc.OracleDriver
URL=jdbc:oracle:thin:@<host>:<port>:<SID>
user=my_core
password=my_core

    Above contents can vary according to which DB, you want to refer.

5.    In the Component of your defination file, change the "datasource" to new path(applicable only if your repository was going to be versioned repository).
             dataSource=/atg/dynamo/service/jdbc/JTDataSource

6.   If your repository refers to any OOTB repository, override the OOTB component in <DYNAMO_HOME>\home\localconfig. And provide the "datasoruce"


            dataSource=/atg/dynamo/service/jdbc/JTDataSource

7.   User in FakeXADataSource.properties will be core database if its non-versioned database, else it would be one of switch DB.

8.    Run the startSQLRepository command from <DYNAMO_HOME>\home\bin
   startSQLRepository -m Module_name –repository RepositoryComponentPath -outputSQLFile Path of SQL FILE.

Ex: startSQLRepository -m MyStore -repository /my/Library -outputSQLFile c:\test.sql

P.S : startSQLRepository can be executed using the –server attribute and passing server instance of <DYNAMO_HOME>\home\bin. But servers should contain the above files.