2 Replies Latest reply on Feb 19, 2013 4:23 AM by Łukasz Dywicki

    SwitchYard database connection

    Juan Malpica Newbie

      Hi everyone,

       

      I'm just starting with SwithYard and I'm trying to develop a composite service connecting to a postresql database and returning a csv file with all the records retrieved.  Assuming the database is configured as a external datasource in JBoss AS, how should I query the database? should I use a JCA inbound connector or a SQL binding?

       

      Thanks for your help!

       

      Juan.-

        • 1. Re: SwitchYard database connection
          Keith Babo Master

          Welcome!  Go with the SQL Gateway.  You could also use the JPA Gateway if you want to use JPA to map from the database into a domain object.  The camel-sql-binding and camel-jpa-binding quickstarts demonstrate use of a service binding to pull data from a database.  One thing to note on both quickstarts is that there is a "dummy" service binding which feeds test data for the real service to then pull in.

          • 2. Re: SwitchYard database connection
            Łukasz Dywicki Novice

            As Keith already pointed usage of databases in SwitchYard can be done with JPA and SQL gateway. Second is darn easy in configuration. You just need to provide query and reference to datasource using jndi path (eg java:jboss/datasources/GreetDS).