Encrypt my username and password ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Encrypt my username and password ??

so i try to make a class for connection to my sql database, so here i write my username and my password even my domain + port into the body. if there is a way to hide this from ordinary ppl so they dont get too exposed with the type of string, that would be great. thanks. here is my code https://code.sololearn.com/cQ5O6TrbX6iR/?ref=app

24th Apr 2019, 6:12 AM
Michael Fransisco
Michael Fransisco - avatar
3 Answers
+ 1
One of the good options to store your username/pas as a environment variables, and construct your string during execution from them: "jdbc:blabla"+System.getenv("credentials");
24th Apr 2019, 6:28 AM
Dima Makieiev
Dima Makieiev - avatar
+ 1
Not like I am very experienced with decompailing, but it should be save, since code is not storing actual credentials. Also if you so worry about security, better I think will be use some of popular orm like hibernate instead of just jdbc
24th Apr 2019, 6:49 AM
Dima Makieiev
Dima Makieiev - avatar
0
Dima Makieiev is it save from "decompilers" ?
24th Apr 2019, 6:41 AM
Michael Fransisco
Michael Fransisco - avatar