Ready to get started?

Learn more about the CData JDBC Driver for EDGAR Online or download a free trial:

Download Now

Connect to EDGAR Online Data from a Connection Pool in Jetty

The EDGAR Online JDBC Driver supports connection pooling: This article shows how to connect faster to EDGAR Online data from Web apps in Jetty.

The CData JDBC driver for EDGAR Online is easy to integrate with Java Web applications. This article shows how to efficiently connect to EDGAR Online data in Jetty by configuring the driver for connection pooling. You will configure a JNDI resource for EDGAR Online in Jetty.

Configure the JDBC Driver for Salesforce as a JNDI Data Source

Follow the steps below to connect to Salesforce from Jetty.

  1. Enable the JNDI module for your Jetty base. The following command enables JNDI from the command-line:

    java -jar ../start.jar --add-to-startd=jndi
  2. Add the CData and license file, located in the lib subfolder of the installation directory, into the lib subfolder of the context path.
  3. Declare the resource and its scope. Enter the required connection properties in the resource declaration. This example declares the EDGAR Online data source at the level of the Web app, in WEB-INF\jetty-env.xml.

    <Configure id='edgaronlinedemo' class="org.eclipse.jetty.webapp.WebAppContext"> <New id="edgaronlinedemo" class=""> <Arg><Ref refid="edgaronlinedemo"/></Arg> <Arg>jdbc/edgaronlinedb</Arg> <Arg> <New class="cdata.jdbc.edgaronline.EdgarOnlineDriver"> <Set name="url">jdbc:edgaronline:</Set> <Set name="AppKey">20dd8ce9904d422ed89ebde1ad40d</Set> </New> </Arg> </New> </Configure>
    1. Navigate to and create an account.
    2. Register a new application and retrieve the AppKey. You should select one of the available Web APIs this application will use like HackPack, Insider Trades or Institutional Ownership.
      Note: HackPack is the most important Web API that an application can use since it supports a large number of endpoints. If you are getting the "Access Denied" error you must create a new app and select the correct Web API which supports the resource you are querying.
    3. After successfully creating a new app, you can access your keys through your "my account" area. Set the AppKey connection property value equal to the Key of your application.
  4. Configure the resource in the Web.xml:

    jdbc/edgaronlinedb javax.sql.DataSource Container
  5. You can then access EDGAR Online with a lookup to java:comp/env/jdbc/edgaronlinedb: InitialContext ctx = new InitialContext(); DataSource myedgaronline = (DataSource)ctx.lookup("java:comp/env/jdbc/edgaronlinedb");

More Jetty Integration

The steps above show how to configure the driver in a simple connection pooling scenario. For more use cases and information, see the Working with Jetty JNDI chapter in the Jetty documentation.