Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Oracle Wallet Configuration (using Oracle Wallet under Eclipselink JPA )
Oracle Wallet Configuration [message #1765879] Wed, 14 June 2017 07:37 Go to next message
Madhukar Ponnuru is currently offline Madhukar PonnuruFriend
Messages: 6
Registered: June 2017
Junior Member
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 15:55 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1275
Registered: July 2009
Senior Member
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 04:17 Go to previous messageGo to next message
Madhukar Ponnuru is currently offline Madhukar PonnuruFriend
Messages: 6
Registered: June 2017
Junior Member
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 04:29]

Report message to a moderator

Re: Oracle Wallet Configuration [message #1766059 is a reply to message #1766036] Thu, 15 June 2017 09:42 Go to previous messageGo to next message
Madhukar Ponnuru is currently offline Madhukar PonnuruFriend
Messages: 6
Registered: June 2017
Junior Member
@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 09:44]

Report message to a moderator

Re: Oracle Wallet Configuration [message #1766106 is a reply to message #1766059] Thu, 15 June 2017 18:17 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1275
Registered: July 2009
Senior Member
See http://onpersistence.blogspot.com/2008/04/eclipselink-and-datasources.html
Re: Oracle Wallet Configuration [message #1766111 is a reply to message #1765879] Fri, 16 June 2017 01:31 Go to previous messageGo to next message
Madhukar Ponnuru is currently offline Madhukar PonnuruFriend
Messages: 6
Registered: June 2017
Junior Member
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] Fri, 16 June 2017 02:43 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1275
Registered: July 2009
Senior Member
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] Fri, 16 June 2017 03:36 Go to previous messageGo to next message
Madhukar Ponnuru is currently offline Madhukar PonnuruFriend
Messages: 6
Registered: June 2017
Junior Member
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: Fri, 16 June 2017 03:38]

Report message to a moderator

Re: Oracle Wallet Configuration [message #1766115 is a reply to message #1766113] Fri, 16 June 2017 05:46 Go to previous message
Madhukar Ponnuru is currently offline Madhukar PonnuruFriend
Messages: 6
Registered: June 2017
Junior Member
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:Persist vs Merge different exception handling
Next Topic:How to define xml name and plural name of a TAG
Goto Forum:
  


Current Time: Wed Dec 13 09:37:39 GMT 2017

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

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