Database Connection

Trying to make a project that connects to a database but I'm having a hard time figuring out how to connect my database password in my connection string
9 Replies
JavaBot
JavaBot4w ago
This post has been reserved for your question.
Hey @Mike B! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Mike B
Mike BOP4w ago
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/BankifyDB", "root", "");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/BankifyDB", "root", "");
how do i protect my password or go about this, I'm using MYSQL
dan1st
dan1st4w ago
protect yoour password in what way? Just read it from a config file?
Mike B
Mike BOP4w ago
im not sure my plan is to post this project on github though for like my portfolio, sooo would that be the best option?
dan1st
dan1st4w ago
use a config file for it and don't commit that config file
Mike B
Mike BOP4w ago
ahh okay makes sense i just searched it up but also if anyone else wanted to run the proj on their own how would that work?
dan1st
dan1st4w ago
they create their own config file with their DB password
Mike B
Mike BOP4w ago
ohh ok thanks for the clarification
JavaBot
JavaBot4w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?