2011-08-23 66 views
0

我需要知道,如果我的grails應用程序使用MySQL,PostgreSQL或Oracle連接器,那麼在控制器中,我需要根據已配置的連接切換個案如何在grails控制器中知道驅動程序連接

def conn = <any class and method for know the connection> 
switch(conn){ 
    case 'my': ..... 
     breal 
    case 'pg': ..... 
     breal 
    case 'ora': ..... 
     breal 
    default: ..... 
     breal 
} 

請如果你能幫助我...感謝所有!

回答

0
def dbDriver = grailsApplication.config.dataSource.driverClassName 
相關問題