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

  • SEARCH
  • Home
  • 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 3599710
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:24:06+00:00 2026-05-18T20:24:06+00:00

I am building a semester Java project that relies on DB, so I read

  • 0

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 ?

  • 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-18T20:24:07+00:00Added an answer on May 18, 2026 at 8:24 pm

    It is part of JPA (Java Persistence API). It’s roughly said an abstract layer over basic JDBC so that you can interact with the DB on a more object oriented manner without the need to write raw SQL statements and to repeat all the JDBC boilerplate (connection, statement, resultset, etc) over and over.

    Here are some resources about JPA:

    • Java EE 6 tutorial – JPA
    • JPA API javadocs
    • Wikipedia – JPA

    Probably you have configured the Netbeans project to use persistence which would then by default use JPA. If you don’t want to use this, but rather want "plain vanilla" JDBC, then you should create a normal/standard Java project. You however have to write all the JDBC and SQL code yourself.

    See also:

    • JDBC tutorial
    • Java connectivity with MySQL
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a semester Java project that relies on DB, so I read
Building our Android app from Ant fails with this error: [apply] [apply] UNEXPECTED TOP-LEVEL
Building a simple app here; the methods in question: static coin class public static
Building a multi-language application in Java. Getting an error when inserting String value from
Building an app using a calendar on a Google Apps domain that has SSL
Building a Silverlight 5 app that runs in the browser but getting some nagging
Building a lottery scratch-card app in Java. Have allot of it done, just need
building a site using PHP and MySQL that needs to store a lot of
Building a Django app on a VPS. I am not very experienced with setting
Building a website that has English & Japanese speaking users, with the Japanese users

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.