|
|
Re: Oracle Wallet Configuration [message #1766036 is a reply to message #1765968] |
Thu, 15 June 2017 04:17 |
Madhukar Ponnuru 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 #1766113 is a reply to message #1766112] |
Fri, 16 June 2017 03:36 |
Madhukar Ponnuru 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.08266 seconds