AEM 6 work with Oracle DB ?

Avatar

Avatar

srinivasan_m

Avatar

srinivasan_m

srinivasan_m

15-10-2015

In AEM 6 upgrade document, I could able to see the information related to migeating to mongodb. Kindly confirm me that AEM 6 need mongo db only or will it work with Oracle DB also? As AEM 5.x is working with Oracle DB.

View Entire Topic

Avatar

Avatar

therealsatz

Avatar

therealsatz

therealsatz

09-05-2017

Well, This is what I'm trying to do,

I get null for the dataSoruceService Object here.

 

@Reference
 private DataSourcePool dataSourceService;

 public Connection getDataBaseConnection(String dataSourceName) {
  Connection conn = null;
  try {
   String str = dataSourceService.getDataSource(dataSourceName).toString();
   System.out.println("Data source is "+str);
   DataSource dataSource = (DataSource) dataSourceService.getDataSource(dataSourceName);
   System.out.println(dataSource);
   conn = dataSource.getConnection();
  } catch (Exception e) {
   e.printStackTrace();
   System.out.println(e.getMessage());
  }
  return conn;
 }

 public void executeQuery() {
  Connection con = null;
  Statement stmt = null;
  ResultSet rs = null;
  try {
   con = getDataBaseConnection("SampleOracleDS");
   stmt = con.createStatement();
   rs = stmt.executeQuery("select * from forms");
   while (rs.next()) {
    System.out.println("OID=" + rs.getString(1));
   }
  } catch (Exception e) {
   e.printStackTrace();
  } finally {
   try {
    if (rs != null)
     rs.close();
    if (stmt != null)
     stmt.close();
    if (con != null)
     con.close();
   } catch (Exception e) {
    e.printStackTrace();
   }
  }
 }