Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Oracle Wallet Configuration (using Oracle Wallet under Eclipselink JPA )
Oracle Wallet Configuration [message #1765879] Wed, 14 June 2017 03:37 Go to next message
Eclipse UserFriend
Hi,

I am successfully able to connect to my db using oracle wallet from a jdbc thin driver. When i am trying to do the same using eclipselink it is giving invalid username password.

Here is my configuration
JDBC url : jdbc:oracle:thin:/@orcl
Driver : oracle.jdbc.OracleDriver

i skipped user/password as oracle wallet contains them

Entity manager is not getting created with the following exception
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-01017: invalid username/password; logon denied

Error Code: 1017
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:762)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:204)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:304)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:336)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:309)
Re: Oracle Wallet Configuration [message #1765968 is a reply to message #1765879] Wed, 14 June 2017 11:55 Go to previous messageGo to next message
Eclipse UserFriend
What api do you use to connect when using the wallet manager? Logging in EclipseLInk will show what it is using, but you are better off creating your own datasource and having EclipseLink use that if you want to use a non-standard way of connecting.
Re: Oracle Wallet Configuration [message #1766036 is a reply to message #1765968] Thu, 15 June 2017 00:17 Go to previous messageGo to next message
Eclipse UserFriend
Thanks!

But Datasources is not of an option here as i am running it standalone.

Oracle Wallet is a secure way of connecting from jdbc application to a oracle database.

When i try from normal jdbc using the following it works without any issue

String url = "jdbc:oracle:thin:/@" + walletId;
Connection conn = null;
Properties props = new Properties();
Class.forName("oracle.jdbc.OracleDriver");
//STEP 3: Open a connection
System.out.println("Connecting to database..." + url);
conn = DriverManager.getConnection(url, props);
Statement stmt = conn.createStatement();
System.out.println("Statement Created");

I dont need of passing username password only wallet id where i have my database information

I think i might need to override the DefaultConnector implementation to handle this kind of implementation..

[Updated on: Thu, 15 June 2017 00:29] by Moderator

Re: Oracle Wallet Configuration [message #1766059 is a reply to message #1766036] Thu, 15 June 2017 05:42 Go to previous messageGo to next message
Eclipse UserFriend
@Chris Delahunt
I have some how made it run using OracleDatasource
Is there any way to make eclipselink to use OracleDataSource?

[Updated on: Thu, 15 June 2017 05:44] by Moderator

Re: Oracle Wallet Configuration [message #1766106 is a reply to message #1766059] Thu, 15 June 2017 14:17 Go to previous messageGo to next message
Eclipse UserFriend
See http://onpersistence.blogspot.com/2008/04/eclipselink-and-datasources.html
Re: Oracle Wallet Configuration [message #1766111 is a reply to message #1765879] Thu, 15 June 2017 21:31 Go to previous messageGo to next message
Eclipse UserFriend
First thing i tried that only but that was pretty old blog and lot of changes in eclipselink from then and that way is not supported.
Re: Oracle Wallet Configuration [message #1766112 is a reply to message #1766111] Thu, 15 June 2017 22:43 Go to previous messageGo to next message
Eclipse UserFriend
Not sure where you get that impression from, as that is how I do it using EclipseLink version 2.6.4. I'm sure it still works in later versions. What errors are you getting?
Re: Oracle Wallet Configuration [message #1766113 is a reply to message #1766112] Thu, 15 June 2017 23:36 Go to previous messageGo to next message
Eclipse UserFriend
Sorry it worked,

I was not passing the correct persistence name . Now i am able to create the entity manager without any issue.

Thank you very much and appreciate your time.

Here is the code that worked for me for others reference

public DataSource getDataSource()throws Exception{

String url = "jdbc:oracle:thin:/@orcl"; // orcl is the wallet id i am using here
OracleDataSource source = new OracleDataSource();
source.setDriverType("oracle.jdbc.OracleDriver");
source.setURL( url );
source.setDataSourceName("jdbc/myOracleDatasource");
return source;
}

// emf & em creation
properties
.put(PersistenceUnitProperties.NON_JTA_DATASOURCE,getDataSource());
emf = Persistence.createEntityManagerFactory("IFX_PERSISTENCE", properties);
EntityManager em = emf.createEntityManager();

[Updated on: Thu, 15 June 2017 23:38] by Moderator

Re: Oracle Wallet Configuration [message #1766115 is a reply to message #1766113] Fri, 16 June 2017 01:46 Go to previous message
Eclipse UserFriend
Thanks for the help

I have added the full details of Wallet creation and the way to connect to database using eclipselink.
Hope this will help others who want to learn more about Wallet configuration

http://javaperformancetools.blogspot.in/2017/06/oracle-wallet-jdbc-jpa-configuration.html

Regards
Madhukar
Previous Topic:eclipselink 2.6.4 STUCK thead
Next Topic:How to define xml name and plural name of a TAG
Goto Forum:
  


Current Time: Mon Jul 14 09:08:18 EDT 2025

Powered by FUDForum. Page generated in 0.43439 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top