Re: Configuring SSL

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 18 2008 - 11:31:02 EDT

  • Next message: Elena Doyle: "RE: Configuring SSL"

    The DataSourceFactory interface changed between Cayenne releases. Make
    sure you implement the version of the interface matching Cayenne
    version that you are using.

    Andrus

    On Jun 18, 2008, at 5:01 PM, Elena Doyle wrote:
    > Andrus,
    >
    > Thank you.
    >
    > I have instantiated BasicDataSource but there does not seem to be a
    > method available to set
    > properties! The only thing I can see is addConnectionProperty(String
    > name, String value)
    >
    > I used that but now I am left with one an error:
    >
    > "The type OracleSSLDataSourceFactory must implement the inherited
    > abstract method
    > DataSourceFactory.getDataSource(String, Level)???"
    >
    > Please help if you can
    >
    >
    >
    > I do:
    >
    > import javax.sql.DataSource;
    > import org.apache.commons.dbcp.*;
    > import org.apache.cayenne.conf.*;
    >
    > public class OracleSSLDataSourceFactory implements DataSourceFactory {
    >
    > protected Configuration parentConfiguration;
    >
    > public void initializeWithParentConfiguration(Configuration
    > parentConfiguration) {
    > this.parentConfiguration = parentConfiguration;
    > }
    >
    > public DataSource getDataSource(String location) throws Exception{
    >
    > String url =
    > "jdbc:oracle:thin..DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)
    > (HOST=servername)(PORT=2484))
    > (CONNECT_DATA=(SERVICE_NAME=servicename)))";
    >
    > BasicDataSource ds= new BasicDataSource();
    >
    > ds.setUrl(url);
    > ds.addConnectionProperty("user", "user");
    > ds.addConnectionProperty("password", "password");
    > ds.addConnectionProperty("oracle.net.ssl_cipher_suites",
    > "(SSL_DH_anon_WITH_3DES_EDE_CBC_SHA, SSL_DH_anon_WITH_RC4_128_MD5,
    > SSL_DH_anon_WITH_DES_CBC_SHA)");
    >
    > return ds;
    >
    >
    >
    > }
    > }
    >
    >
    >
    > -----Original Message-----
    > From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Sent: 18 June 2008 13:13
    > To: use..ayenne.apache.org
    > Subject: Re: Configuring SSL
    >
    > No, it is a part of Apache commons-dbcp library:
    >
    > http://commons.apache.org/dbcp
    >
    > Andrus
    >
    >
    > On Jun 18, 2008, at 3:06 PM, Elena Doyle wrote:
    >> Andrus,
    >>
    >> What is DBCP BasicDataSource, please? Is it part of your framework?
    >>
    >> Elena
    >>
    >> -----Original Message-----
    >> From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    >> Sent: 16 June 2008 16:55
    >> To: use..ayenne.apache.org
    >> Subject: Re: Configuring SSL
    >>
    >> Hi Elena,
    >>
    >> Here is a (badly written) factory for DBCP:
    >>
    >> https://svn.apache.org/repos/asf/cayenne/main/trunk/framework/
    >> cayenne-
    >> jdk1.5-unpublished/src/main/ja
    >> va/org/apache/cayenne/conf/DBCPDataSourceFactory.java
    >>
    >> You can use a similar approach to properties loading, but then
    >> instead
    >> of doing what we did with DBCPDataSourceProperties/
    >> DBCPDataSourceBuilder helper classes, do
    >> this:
    >>
    >> 1. Load a properties file (that will have to include the URL, user
    >> name, password, and any of your custom settings) to a
    >> java.util.Properties object.
    >> 2. instantiate DBCP BasicDataSource, and call its set* methods to
    >> populate the properties.
    >>
    >> Andrus
    >>
    >> On Jun 16, 2008, at 6:39 PM, Elena Doyle wrote:
    >>
    >>> Andrus,
    >>>
    >>> Many thanks for this. Due to bussiness needs I need to write a
    >>> custom
    >>> one. As I am mostly a database and PL/SQL person, is the source code
    >>> of the standard Cayenne data factory available anywhere. I could not
    >>> find it in the repository.
    >>>
    >>> Many thanks
    >>>
    >>> Elena
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jun 18 2008 - 11:31:32 EDT