Hi All,

I am using EmbeddedDataSource to create a database and in a separate step
enable authentication and encryption on the database. I have enabled
authentication using the following code:

            // set authentication 
            CallableStatement callableStatement = connection.prepareCall(""
+
                    "CALL SYSCS_UTIL.SYSCS_SET_DATABASE_PROPERTY(?, ?)");
//            callableStatement.setString(1,
"derby.database.sqlAuthorization");
            callableStatement.setString(1,
"derby.connection.requireAuthentication");
            callableStatement.setString(2, "true");
            callableStatement.execute();

However, I do not see a similar mechanism to enable encryption. So I tried
the following code:

        // get properties from props file
        String sysDir = props.getProperty("derby.system.home");
        String dbName = props.getProperty("database.name");

        EmbeddedDataSource dataSource = new EmbeddedDataSource();
        dataSource.setUser(userName);
        dataSource.setPassword(password);
        dataSource.setConnectionAttributes("dataEncryption=true");
        dataSource.setConnectionAttributes("bootPassword="+password);
       
dataSource.setConnectionAttributes("encryptionAlgorithm=AES/CBC/NoPadding");
       
dataSource.setDatabaseName(sysDir+System.getProperty("file.separator")+dbName);

        connection = dataSource.getConnection();

But this does not seem to enable encryption because when I shut down the
database and try to reconnect to it by passing it the wrong bootpassword/no
bootpassword, it boots up the database. Is there any way of enabling
encryption using EmbeddedDataSource?

Thanks,
Jay
-- 
View this message in context: 
http://www.nabble.com/Enabling-encryption-using-DataSource-after-creating-a-database-tp20040339p20040339.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.

Reply via email to