Ready to get started?

Download a free trial of the Basecamp Driver to get started:

 Download Now

Learn more:

Basecamp Icon Basecamp JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Basecamp including Projects, People, Documents, Messages, and more!

Connect to Basecamp Data from a Connection Pool in Jetty



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

The CData JDBC driver for Basecamp is easy to integrate with Java Web applications. This article shows how to efficiently connect to Basecamp data in Jetty by configuring the driver for connection pooling. You will configure a JNDI resource for Basecamp 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 Basecamp data source at the level of the Web app, in WEB-INF\jetty-env.xml.

    <Configure id='basecampdemo' class="org.eclipse.jetty.webapp.WebAppContext"> <New id="basecampdemo" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg><Ref refid="basecampdemo"/></Arg> <Arg>jdbc/basecampdb</Arg> <Arg> <New class="cdata.jdbc.basecamp.BasecampDriver"> <Set name="url">jdbc:basecamp:</Set> <Set name="User">test@northwind.db</Set> <Set name="Password">test123</Set> </New> </Arg> </New> </Configure>

    Basecamp uses basic or OAuth 2.0 authentication. To use basic authentication you will need the user and password that you use for logging in to Basecamp. To authenticate to Basecamp via OAuth 2.0, you will need to obtain the OAuthClientId, OAuthClientSecret, and CallbackURL connection properties by registering an app with Basecamp.

    See the Getting Started section in the help documentation for a connection guide.

    Additionally, you will need to specify the AccountId connection property. This can be copied from the URL after you log in.

  4. Configure the resource in the Web.xml:

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

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.