Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] DatasourceLogin

Hello,

  I have a problem. I'm trying to set JDBC connection property. I found that I need to set property with DatabaseLogin.setProperty(<key>, <value>).
Bud I don't know how to use this my DatabaseLogin object.

I use EclipseLink 1.0 under JavaSE

Current version
                    Map<String, Object> params = new HashMap<String, Object>();
                    params.put("eclipselink.jdbc.url", getServerJDBCURL());
                    params.put("eclipselink.jdbc.driver", getServerJDBCDriver());
                    params.put("eclipselink.jdbc.user", getServerJDBCUser());
                    params.put("eclipselink.jdbc.password", getServerJDBCPassword());

                    EntityManagerFactory factory = Persistence.createEntityManagerFactory("pu-test, params);
                    EntityManager entityManager = factory.createEntityManager();


Java SE replacement with:

                    DatabaseLogin databaseLogin = new DatabaseLogin();
//... set connection

                    databaseLogin.setProperty("key", "value");


What I need and I don't know how:
*) use settings from persistence unit from persistence.xml
*) replace jdbc connection with my values
*) set JDBC connection custom property  (eg.  "encoding" = "UTF-8")
*) get EntityManagerFactory and EntityManager.

  Thank you very much for your help.

 Martin


Back to the top