Symantec IGA

  • 1.  Can a JDBC Connection Defined in IdM be accessed from a BLTH?

    Posted Mar 04, 2016 11:27 AM

    We are accessing an outside data base from within several BLTHs - by establishing the JDBC connection directly from the BLTH.    Would it be possible to access the outside data base through a JDBC Connection defined in IdM?   We have defined the connection in IdM - and demonstrated that it works in Policy Xpress.   But cannot find any information how to reference the connection (defined in IdM) from a BLTH exit.   Hoping that by using the connection defined in IdM we can take advantage of any connection pooling built into IdM.



  • 2.  Re: Can a JDBC Connection Defined in IdM be accessed from a BLTH?

    Broadcom Employee
    Posted Mar 18, 2016 02:07 PM

    shaei03, Sagi_Gabay,

      Team, Can one of you help here? is it possible to get a jindi name reference in a BLTH?

     

    Thanks,

    Bill



  • 3.  Re: Can a JDBC Connection Defined in IdM be accessed from a BLTH?

    Broadcom Employee
    Posted Mar 19, 2016 10:59 AM

    Yes you can use any existing jdbc connection defined at application server level in BLTH. It is simple java. You just have to create connection using jndi name you have defined at application server level. Same jndi name which you are using in PX will work in BLTH. 



  • 4.  Re: Can a JDBC Connection Defined in IdM be accessed from a BLTH?

    Broadcom Employee
    Posted Mar 21, 2016 01:27 PM

    Hi Praveen,

     

    Do you have an example of what that might look like?

     

    Thanks

    Scott Owens



  • 5.  Re: Can a JDBC Connection Defined in IdM be accessed from a BLTH?
    Best Answer

    Broadcom Employee
    Posted Mar 22, 2016 10:52 AM

    Hi Scott,

    this is the basic code I'm using (and re-using for years) to make DB queries from BLTH(also can be used in Rhino script in the SetOptions under a dropdown to set values for example):

    // Set DB Connection Info

      importPackage(Packages.javax.naming);

      importPackage(Packages.javax.sql);

      importPackage(Packages.java.sql);

      importPackage(Packages.java.util);

     

     

      // Get DB connection

      var datasourceName = "<JDBC Name>";

      var initialContext = new InitialContext();

      var dataSource =  initialContext.lookup(datasourceName);

      var connection = dataSource.getConnection();

      var query = "select * from Table";

      var stmt = connection.prepareStatement(query);

      var resultSet = stmt.executeQuery();

     

    // going over the result set:

    while(resultSet.next()){

         results.add(resultSet.getString(1));

    }

     

    Hope it helps,

    Chen Rayman



  • 6.  Re: Can a JDBC Connection Defined in IdM be accessed from a BLTH?

    Broadcom Employee
    Posted Mar 22, 2016 11:22 AM

    Thank you Chen!