Home ms sql server datasource java config in spring boot
Reply: 0

ms sql server datasource java config in spring boot

user737
1#
user737 Published in April 25, 2018, 6:11 pm

I am trying to use java config for my ms sql server, but unable to find any information regarding how to define it as Bean in config class. I have used Oracle earlier and it was very easy to configure it. I used to write this code for Oracle.

@Bean
DataSource dataSource() throws SQLException {

    OracleDataSource dataSource = new OracleDataSource();
    dataSource.setUser(username);
    dataSource.setPassword(password);
    dataSource.setURL(url);
    dataSource.setImplicitCachingEnabled(true);
    dataSource.setFastConnectionFailoverEnabled(true);
    return dataSource;
}

As of now I am using application.properties but I don't wants to continue using this file.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.330649 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO