Database connection encryption and integrity with ColdFusion and Oracle thin client
As ColdFusion datasource we are using the Oracle thin client to connect with the database. So, basically we are using a JDBC URL such as jdbc:oracle:thin:@... and as Driver Class oracle.jdbc.OracleDriver
This works successfully however we would like to set encryption and integrity parameters as well. In Java this开发者_StackOverflow社区 is done similarly by setting a Properties object prior to getting a connection as follows:
Properties prop = new Properties();
prop.put("oracle.net.encryption_client", "REQUIRED");
prop.put("oracle.net.encryption_types_client", "( DES40 )");
prop.put("oracle.net.crypto_checksum_client", "REQUESTED");
prop.put("oracle.net.crypto_checksum_types_client", "( MD5 )");
...
OracleDataSource ods = new OracleDataSource();
ods.setProperties(prop);
ods.setURL("jdbc:oracle:thin:@localhost:1521:main");
Connection conn = ods.getConnection();
...
Is there a way that I can pass these parameters to the ColdFusion datasource. Ideally, I would love to do this centrally in such way that a change to all the cfquery or cfstoredproc is not needed.
I also know that in application servers such as Oracle AS there is an option when creating a datasource which says "Add Properties". In there you can add such properties. So, I was thinking of maybe creating a JNDI DS in the app. server and then magically connecting to it but this may have some impacts on the app.
Besides this I was also thinking of communicating with the CF datasource through the CF admin API (cfide.adminapi.administrator) and also the option of extending the Oracle driver so that when CF connects with it these params are already set.
I would love to have your professional opinion and suggestions on this.
I know this is an old question...
You absolutely can pass connection string properties to ANY ColdFusion datasource.
Once the datasource is open in CF ADMIN, open the Advanced Settings. The first option you can change in the Advanced Settings tab is "Connection String". This would be all the name-value pairs of parameters separated by ampersand (&) to be passed on the connection to the database.
For example:
encryption_client=REQUIRED&encryption_types_client=DES40&crypto_checksum_client=REQUESTED&crypto_checksum_types_client=MD5`
However, the answer to the OP, is that you can pass parameters along on the JDBC URL as well.
For example:
Using the Progress Datadirect driver, your JDBC URL might look like this:
jdbc:datadirect:oracle://server;SID=someSID;encryption_client=REQUIRED;encryption_types_client=DES40;crypto_checksum_client=REQUIRED;crypto_checksum_types_client=MD5
Just remember, that your params are separated by semicolons, not commas.
When defining a datasource, make sure you are using the right KIND of driver... Some features aren't available from the native datasource setup screens, so to use more advanced features, you may need to use OTHER.
All data sources in ColdFusion can be configured with a connection string. I would see if it is possible to pass your properties as part of the connection string.
To change the connection string open the data source in the CF admin and go to 'Advanced Settings'. There is a box there you can fill out.
If you figure that out then the whole process should be transparent those those using the data source.
I hope that helps some.
精彩评论