0

While setting up a derby connection if we use plain java code we can specify the schema for given connection using

conn.setSchema("APP");

When we using JDBCTemplate we have to specify DataSource object to this template. There is no setSchema method in DataSource class.

DriverManagerDataSource dataSource=new DriverManagerDataSource();
dataSource.setDriverClassName(driver);
dataSource.setUrl(url);
dataSource.setUsername(username);
dataSource.setPassword(password);

Also i could not specify it as derby properties. Derby properties mentioned in the DOCs.

bootPassword=key 
create=true 
databaseName=nameofDatabase    
dataEncryption=true 
encryptionProvider=providerName    
encryptionAlgorithm=algorithm 
territory=ll_CC    
logDevice=logDirectoryPath 
createFrom=BackupPath    
restoreFrom=BackupPath 
rollForwardrecoveryFrom=BackupPath    
password=userPassword 
shutdown=true 
user=userName

What is the best way to overcome this issue. Is there any solution to specify schema?

Buru
  • 8,018
  • 7
  • 47
  • 77
  • To clarify: you are trying to get Spring to use a explicit schema name, not the default schema name (which is derived from the name of the user)? – Bryan Pendleton Jul 17 '15 at 13:55
  • Yes. Will it use username or APP as default – Buru Jul 17 '15 at 19:11
  • See this related question: http://stackoverflow.com/questions/11040213/in-derby-should-i-be-using-the-app-schema-or-the-mydbname-schema and also see this page in particular from the Derby docs about how it picks the default schema name: http://db.apache.org/derby/docs/10.11/ref/rrefsqlj32268.html – Bryan Pendleton Jul 18 '15 at 15:16

0 Answers0