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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:51:15+00:00 2026-05-15T10:51:15+00:00

I am still new to Java and Eclipse and I’m trying to get my

  • 0

I am still new to Java and Eclipse and I’m trying to get my application to connect to a database. I think I want to use EclipseLink, but all of the documentation on the matter assumes you already know everything there is to know about everything.

I keep getting linked back to this tutorial: http://www.vogella.de/articles/JavaPersistenceAPI/article.html

But it’s basically useless because it doesn’t tell you HOW to do anything. For the Installation section, it tells you to download EclipseLink and gives you a link to the download page, but doesn’t tell you what to do with it after you download. The download page doesn’t either. I used the “Install new software” option in Eclipse to install EclipseLink into Eclipse, but it gave me like 4 different options, none of which are explained anywhere. It gave me options JPA, MOXy, SDO, etc, but I don’t know which one I need. I just installed them all. Everything on the web assumes you are already a Java guru and things that are second nature to Java devs are never explained, so it’s very frustrating for someone trying to learn.

So how do I install and USE EclipseLink in my project and what do I need to do to connect it to a Microsoft SQL server? Again, I am new to all of this so I have no clue what to do. Thanks for the help.

  • 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-15T10:51:15+00:00Added an answer on May 15, 2026 at 10:51 am

    I don’t think you need to just learn how to use EclipseLink. EclipseLink is a reference implementation for JPA. There are a number of tutorials on the web that you can read up about regarding JPA. I have written a series of articles for beginners for building web applications and one of the sections deals with JPA (and EclipseLink). If you are interested take a look and I welcome discussion on it to improve it as well as my own understanding.

    EDIT: Here’s a more direct answer to your question. I hope it helps

    There are a number of different download approaches to take for EclipeLink. This is one way:

    Download EclipseLink Installer

    Extract the eclipselink.jar from the download jlib directory and include it in your projects classpath.

    Download the ejb3-persistence.jar and include it in your projects classpath.

    I haven’t got SQL server myself but you would need to include the sqljdbc jar in your classpath. Don’t know what version you are using or if it even matters but you can try this link and download the 1033\sqljdbc_3.0.1301.101_enu.tar.gz file. Extract it and copy the sqljdbc.jar into your projects classpath.

    Here’s a simple standalone example:

    persistence.xml (saved in your META-INF directory in your src folder)

    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
        http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
        version="1.0">
    
        <persistence-unit name="escribs-pu" transaction-type="RESOURCE_LOCAL">
            <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
            <exclude-unlisted-classes>false</exclude-unlisted-classes>
            <properties>
                <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
                <!-- haven't tested with SQL server so hope the below is correct -->
                <property name="eclipselink.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
                <property name="eclipselink.jdbc.url" value="jdbc:sqlserver://localhost;databaseName=MyDB" />
                <property name="eclipselink.jdbc.user" value="myusername" />
                <property name="eclipselink.jdbc.password" value="mypassword" />
            </properties>
        </persistence-unit>
    </persistence>
    

    Entity class:

    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.Table;
    
    @Entity
    @Table(name="person")
    public class Person {
        private Long id;
        private String name;
    
        @Id
        public Long getId() {
            return id;
        }
        public void setId(Long id) {
            this.id = id;
        }
    
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
    }   
    

    SimpleTest

    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.EntityTransaction;
    import javax.persistence.Persistence;
    
    public class SimpleTest {
        public static void main(String[] args) {
            EntityManagerFactory emf = Persistence.createEntityManagerFactory("escribs-pu");
    
            Person person = new Person();
            person.setId(1L);
            person.setName("Clark");
    
            EntityManager em = null;
            EntityTransaction tx = null;
            try {
                em = emf.createEntityManager();
                tx = em.getTransaction();
                tx.begin();
                em.persist(person);
                tx.commit();
    
                System.out.println("Person id: " + person.getId());
            } catch (RuntimeException e) {
                tx.rollback();
                throw e;
            } finally {
                if (em != null && em.isOpen()) {
                    em.close();
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 439k
  • Answers 439k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Of course. The Android Web View is a full fledged… May 15, 2026 at 5:03 pm
  • Editorial Team
    Editorial Team added an answer Yes, indeed, you can use the debugger in VS to… May 15, 2026 at 5:03 pm
  • Editorial Team
    Editorial Team added an answer What they probably do is turn the caption bar off… May 15, 2026 at 5:03 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.