Specifying Custom JCE Provider

Specify a custom JCE provider in jConnect. If jConnect cannot use the specified JCE provider, it attempts to use the JCE providers configured in the JRE security profile.

  1. Set the JCE_PROVIDER_CLASS property to the fully qualified class name of the provider you want to use.
    For example, to use the Bouncy Castle JCE:
    String url = "jdbc:sybase:Tds:myserver:3697";
    Properties props = new Properties();
    props.put("ENCRYPT_PASSWORD ", “true”);
    props.put("JCE_PROVIDER_CLASS",
    "org.bouncycastle.jce.provider.BouncyCastleProvider");
    
    /* Set up additional connnection properties as needed */
    props.put("user", "xyz");
    props.put("password", "123");
    
    /* get  the connection */
    Connection con = DriverManager.getConnection(url, props);
  2. Configure the JCE provider.
    Either:
    • Copy the JCE provider jar file into the JRE standard extension directory:
      • For UNIX platforms: ${JAVA_HOME}/jre/lib/ext

      • For Windows: %JAVA_HOME%\jre\lib\ext

    • Or, if you cannot copy the JCE jar file to the appropriate directory, see JCE Reference Guide for instructions on setting up an external JCE provider.

    If no other JCE providers are configured, or if configured providers do not support the required transformation and password encryption is enabled, the connection fails.