Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 768051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:07:12+00:00 2026-05-14T18:07:12+00:00

How to protect database username and password in shared hosting enviornment using spring <bean

  • 0

How to protect database username and password in shared hosting enviornment using spring

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" >
        <property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
        <property name="url"><value>jdbc:mysql:///BUSINESS</value></property>
        <property name="username"><value>root</value></property>
        <property name="password"><value>password</value></property>            
    </bean>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:07:13+00:00Added an answer on May 14, 2026 at 6:07 pm

    I am not aware of any Spring specific solution for this.

    In a shared hosting environment one should make sure that file’s aren’t public readable so other users can’t view the content of you’re files. In case of a shared application server, the app server should be in the same group, so only the application server gets access to you’re files.

    An application should never use a MySql root password. You should create an MySql account with limited rights on a specific schema (for example an user that can only do DML statements and not DDL statements).

    To keep the username/password out of a plain text file you could hardcode the configuration in a Java class (This is basicaly security through obscurity). Replacement configuration:

    <bean id="dataSource"
        class="my.app.CustomDriverManagerDataSource" > 
      <property name="driverClassName">
          <value>com.mysql.jdbc.Driver</value>
      </property> 
    </bean>
    

    And add this class to you’re class path

    import org.springframework.jdbc.datasource.DriverManagerDataSource;
    
    public class CustomDriverManagerDataSource extends DriverManagerDataSource {
    
      public DriverManagerDataSource() {
        super("jdbc:mysql:///BUSINESS","root","password");
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In trying to write a simple C# ADO.NET application to connect to my database
I have a java program that connects to a MySql database and it's working
I am using AspNetSqlMembershipProvider in my ASP .Net 4 web application project. I have
I'm on my first MVC project and am at a point where I need
Here is the login system to which the secure login is to be implemented/
ok here is the situation , I want to use a login form for
I'm working on the symfony tutorial jobeet and I have problems to get a
I have a hibernate project, which uses JPA. my persistence.xml contents is as follows:
My infuriating problem of the day is this: I'm trying to use Hibernate to
I am creating my first serious project in PHP and I want to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.