how should i connect database to java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

how should i connect database to java

18th Jan 2017, 1:01 PM
saru
3 Answers
0
It depends hardly on the used database technology. But in general use JDBC for this
18th Jan 2017, 1:30 PM
Andreas K
Andreas K - avatar
0
Connection conn = DriverManager.getConnection("jdbc:mysql://serverName/dbName", "userName", "password");
18th Jan 2017, 1:57 PM
Uran Kajtazaj
Uran Kajtazaj - avatar
0
Use jdbc package. Create object of drivermanager class and then connection object. It's a long process but check it out here: https://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm
18th Jan 2017, 3:29 PM
Divesh Agarwal
Divesh Agarwal - avatar