Support #3800

Portlet access to RDBMS

Added by Kostas Hirikakis over 3 years ago. Updated over 3 years ago.

Status:ClosedStart date:Apr 27, 2016
Priority:HighDue date:
Assignee:Massimiliano Assante% Done:

100%

Category:Default
Infrastructure:
Milestones:
Duration:

Description

We are developing a user portlet and we are using Hibernate for data management. The jdbc connection is in a config xml file. Right now we are invoking a local postgres.
Upon deployment the portlet should invoke a database on the server. How do we request for the database connection info?
Mind that we are using gcube portlet 4.0.0-SNAPSHOT and we are not using GWT.


Related issues

Related to BlueBRIDGE - Task #3893: Create a database for SimulFishGrowth (WP6) Closed May 05, 2016 May 13, 2016

History

#1 Updated by Massimiliano Assante over 3 years ago

  • Assignee changed from _InfraScience Systems Engineer to Panagiota Koltsida

Kostas,
upon deployment the portlet should invoke a database on the infrastructure, the db coordinates and credentials will be registered into a service endpoint to type database in the infrastructure information system. Please refer to our greek colleagues @NKUA to understand how to register a new service endpoint in the infrastructure.

I'm reassigning the ticket to @p.koltsida@di.uoa.gr

#2 Updated by Leonardo Candela over 3 years ago

  • Sprint changed from Unsprintable to WP06

#3 Updated by Massimiliano Assante over 3 years ago

  • Sprint changed from WP06 to Unsprintable

#4 Updated by Massimiliano Assante over 3 years ago

  • Sprint changed from Unsprintable to WP06

#5 Updated by Kostas Hirikakis over 3 years ago

As we are using Hibernate, could someone please point me to a tutorial on how to do that?
Is Hibernate supported? If not, could someone please point to a tutorial demonstrating basic CRUD operations?

#6 Updated by Panagiota Koltsida over 3 years ago

  • Assignee changed from Panagiota Koltsida to Lucio Lelii

#7 Updated by Lucio Lelii over 3 years ago

  • Assignee changed from Lucio Lelii to Massimiliano Assante

First of all you have to add a ServiceEndpoint with all the information related to your database in the IS (@massimiliano.assante@isti.cnr.it can you provide the wiki link for ServiceEnpoint creation) and then you have to use the ic-client (https://wiki.gcube-system.org/gcube/Ic-client) to discover this resource and retrieve the information you need for the connection.

#8 Updated by Massimiliano Assante over 3 years ago

Dear Kostas,
I'll try to explain better:
Hibernate is supported, but the credentials about jdbc connection that you read in a config xml file, must be changed so that you will read them from the infrastructure. In order to do so we will create an infrastructure resource of type "Service Endpoint" that will contain all the necessary information about jdbc connection.

I'm reporting below a service endpoint example used from some portlet to access a database (SardaraDB) so that you can better understand what I am talking about.

<Resource version="0.4.x">
   <ID>25005aaa-3bb6-4003-961d-2f9c3ca842be</ID>
   <Type>RuntimeResource</Type>
   <Scopes>  
      <Scope>/d4science.research-infrastructures.eu</Scope>
   </Scopes>
   <Profile>   
     <Category>Database</Category> 
      <Name>SardaraDB</Name>
      <Description>PostGIS DB</Description>
      <Platform>
         <Name>Postgres</Name>
         <Version>9</Version>
         <MinorVersion>2</MinorVersion>
         <RevisionVersion>0</RevisionVersion>
         <BuildVersion>0</BuildVersion>
      </Platform>
      <RunTime>    
         <HostedOn>db-tuna.d4science.org</HostedOn>     
         <GHN UniqueID="" />
           <Status>READY</Status>
        </RunTime>
      <AccessPoint>
         <Description>SardaraDB</Description>
         <Interface>
            <Endpoint EntryName="sardaradb">db-tuna.d4science.org</Endpoint>
         </Interface>
         <AccessData>   
            <Username>********</Username>
            <Password>************</Password>
         </AccessData>
      </AccessPoint>
   </Profile>

Once you provide us with the necessary information about jdbc connection (host, db name and credentials) we will create one resource for your portlet. CNR can do this.

Now, in order to retrieve the jdbc connection from the infrastructure you should use a specific library called ic-client, please see this: https://wiki.gcube-system.org/gcube/Ic-client#Conditions_and_Result_Expressions
What you will also need are the development encryption keys to decrypt the db credentials, we can point you to them.

#9 Updated by Massimiliano Assante over 3 years ago

  • Status changed from New to Closed

#10 Updated by Massimiliano Assante over 3 years ago

  • Related to Task #3893: Create a database for SimulFishGrowth (WP6) added

#11 Updated by Denis Pyriochos over 3 years ago

  • % Done changed from 0 to 100

Also available in: Atom PDF