5 Replies Latest reply: Sep 18, 2013 6:25 PM by Rajesh K Duraisamy RSS

    My Repository creation do not connect  why ??

    01acd901-e8d9-40f3-93ba-851614396ef1

      Hi ,

       

         I was trying to create a ATG repository for my project as given below.

       

      1) Created a myRepository.xml as,

       

      <!DOCTYPE gsa-template PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN"

      "http://www.atg.com/dtds/gsa/gsa_1.0.dtd">

      <gsa-template>

          <item-descriptor name="my_desc">

              <table name="my_table" type="primary" id-column-name="last_update_time">

                  <property name="summary" column-name="activity_summary" data-type="string"  display-name="summary"

                          category-resource="categoryBasics">

                          <attribute name="propertySortPriority" value="-11" />

                  </property>

                  <property name="detail" column-name="activity_detail" data-type="string" display-name="detail"

                          category-resource="categoryBasics">

                          <attribute name="propertySortPriority" value="-11" />

                  </property>

              </table>

          </item-descriptor>

      </gsa-template>

       

      for the DB table  :

      desc my_table;

      Name                  Null Type        

      --------------------- ---- -------------

      ACTIVITY_SUMMARY      VARCHAR2(32)

      ACTIVITY_DETAIL       VARCHAR2(32)

      LAST_UPDATE_TIME           TIMESTAMP(6)

       

      2) Created the myDB.properties file as,

       

      $class=atg.adapter.gsa.GSARepository

      $scope=global

      definitionFiles=/com/db/myRepository.xml

      XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory

      transactionManager=/atg/dynamo/transaction/TransactionManager

      idGenerator=/atg/dynamo/service/IdGenerator

      dataSource=<Poiniting to my datasource which points to my JDNI values>

      lockManager=/atg/dynamo/service/ClientLockManager

      checkTables=false

       

      3) Updated the /atg/registrory/ContentRepositories properties as,

       

      initialRepositories+=/com/db/myDB,\

       

      4) On starting my ATG server. I get the following error.

       

      'my_table' does not exist in a table space accessible by the data source. DatabaseMetaData.getColumns returns no columns. Catalog=null Schema=TEST_A

       

      But when I tested the same table using the same JDNI with simple jsp file . I'm able to access and see the content of the table.

       

       

      Can you please let me know what is wrong in my approach ?

       

      Thanks & Regards,

      Balabaskaran Kanagasabai

       

      PS: The content of the Jsp file to access the same table with JNDI defined.

       

      <%@ page pageEncoding="UTF-8" contentType="text/html" %>

      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

      <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

       

      <%@ page import="javax.naming.InitialContext" %>

      <%@ page import="javax.naming.NamingException" %>

      <%@ page import="java.sql.Connection" %>

      <%@ page import="java.sql.Statement" %>

      <%@ page import="java.sql.ResultSet" %>

      <%@ page import="java.sql.DatabaseMetaData" %>

       

      <%@ page import="javax.sql.DataSource" %>

      <%@ page import="java.sql.SQLException" %>

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

      <html>

      <head>

      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

      <title>jndi info for your application</title>

      </head>

      <body>

      <style type="text/css">

        table{

          border-collapse: collapse;

          border: 1px solid black;

        }

        table td{

          border: 1px solid black;

          align : center;

        }

      </style>

       

      <h3 align="center"> Your DB INFO </h3>

      <table align="center">

          <tr style="font:bold;background-color: lightblue; font-family:Arial; color:green; font-size:10pt;" align="center">

          <td>JNDI</td><td>QUERY_DATE</td><td>DB_NAME</td><td>USER_NAME</td><td>DB_INST</td><td>DB_SERVER</td><td>SESS_ID</td><td>OS_USER</td><td>DB_DOMAIN</td>

          <td>SERVICE_NAME</td><td>CLIENT_HOST</td><td>PROG_NAME</td>

          </tr>

      <%

           try{

              String query = "select * from my_table" ;

              Connection conn = getConnection("jndi/mine");

              // connect to database

              Statement stmt = conn.createStatement();

              ResultSet rs =  stmt.executeQuery(query);

              while (rs.next()){

      %>      

      <tr align="center" style="font-family:Arial; color:green; font-size:10pt;">

      <td>jdbc/DemobarDS</td><td><%= rs.getString(1) %></td><td><%= rs.getString(2) %></td><td><%= rs.getString(3) %></td>

      <td><%= rs.getString(4) %></td><td><%= rs.getString(5) %></td><td><%= rs.getString(6) %></td><td><%= rs.getString(7) %></td>

      <td><%= rs.getString(8) %></td><td><%= rs.getString(9) %></td><td><%= rs.getString(10) %></td><td><%= rs.getString(11) %></td>

      </tr>          

      <%      

              }

             if ( conn != null ) {

                try { conn.close(); } catch ( Exception ex ) {}

                conn = null;

              }

              }catch(Exception e){

                  e.printStackTrace();

              }

      %>

       

       

       

      </table>

      </body>

      </html>

      <%!

      private Connection getConnection(String jndiName) {

          Connection connection = null;

          try {

              InitialContext context = new InitialContext();

              DataSource dataSource = (DataSource) context

                  .lookup(jndiName);

              connection = dataSource.getConnection();

          } catch (NamingException e) {

              e.printStackTrace();

          } catch (SQLException e) {

              e.printStackTrace();

          }

          return connection;

          }

       

      %>