I am building a semester Java project that relies on DB, so I read tutorials about JDBC and I built simple app that reads from a MySQL DB. I tried Netbeans desktop database application to read the generated code, but I found that Netbeans takes a very different approach to connect to the database and I can't understand why it uses a persistence.xml
file and what is the persistence package used for?
Class.forName("com.mysql.jdbc.Driver");
String connectionUrl = "jdbc:mysql://localhost/mysql?" +
"user=root&password=123456";
Connection con = DriverManager.getConnection(connectionUrl);
Can anyone guide me to tutorials to understand this approach ? And why Netbeans uses this code instead of the usual code I posted ?