2 Replies Latest reply on Jun 7, 2013 11:49 PM by Ankur Srivastava

    ERR In Connecting Oracle DB

      Hi All,

      I am a newbie in RhoConnect. I have to connect oracle 11g from RhoConnect to get data and pass to Rhodes application.

       

      The sync process is going gud as i am able to proceed at the tutorial steps. Now i want the same thing from oracle db instead of webservice.

       

      I have used Oci8 gem to do so. it is througing err. please help me out in this or correct me if I am proceeding wrong.

       

       

      Thanks in advance!!

       

      Pls find code below:

       

      def initialize(source)

          @base = 'http://rhostore.herokuapp.com/products'

          @conn = OCI8.new('ankur', '123456', 'jdbc:oracle:thin:@127.0.0.1:1521:xe')

          super(source)

        end

       

        def query

          @result={}

          cursor = @conn.parse("SELECT * from product")

          cursor.exec()

          @result={}

          while rv = cursor.fetch

               key = rv[0]

          # col1 below should be replaced with how you want your client app to use the data.

               row= {

                 'name' => rv[0],

                 'brand' => rv[1],

                 'price' =>rv[2],

                 'sku'=>rv[3],

                 'quantity'=>rv[4] 

                  }

              @result[key]=row

          end

           cursor.close

        end

       

       

      err:

      [09:52:11 PM 2013-06-06] Failure to create adapter from class Product: #<OCIError: ORA-12154: TNS:could not resolve the connect identifier specified>
      [09:52:11 PM 2013-06-06] ORA-12154: TNS:could not resolve the connect identifier specifiedoci8.c:513:in oci8lib_191.so