Vetrik Kumaran

Greenhorn
+ Follow
since Jul 01, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Vetrik Kumaran


Thanks Knute.

Here is stack trace and code










Hi,

Trying to establish connection to oracle from a servlet (AEM 6.2) , AEM does provide  Data Source Pool service and Ia m trying to use that to get the connection  (Day Commons Library - JDBC pool provider for the Data Source Pool (day.commons.datasource.jdbcpool), Version 1.0.24)

I will paste the code below, and this is all the  error that I get in my error log.  I am trying to understand what is this DirContext

JDBC Connection URI :  jdbc:oracle:thin:@ldap://XXXXXXXXXXXX:3060/AEM_SVC1_L1;cn=OracleContext[/size]


Here is the full error ,

SQLException in getting connection java.sql.SQLRecoverableException: IO Error: JNDI Package failure javax.naming.NotContextException: Not an instance of DirContext, IO Error: JNDI Package failure javax.naming.NotContextException: Not an instance of DirContext

Please let me know if more details needed.



************* Connection Helper class *******************
ublic Connection getConnection(final String oracleDBConnection ) {
DataSource dataSource = null;
Connection connection = null;
try {
if (null != oracleDBConnection && !oracleDBConnection.isEmpty() && null!= dataSourcePool) {
dataSource = (DataSource) dataSourcePool.getDataSource(oracleDBConnection);
if (dataSource != null) {
connection = dataSource.getConnection();
}
}


************************  Test Servlet *************************************

@Component(label = "test connection", description = "test connection", metatype = true)
@Properties({
@Property(label = "Paths", description = "Servlet Paths.", name = "sling.servlet.paths", value = { "/services/testconnection" }, propertyPrivate = false),
@Property(name = "sling.servlet.methods", value = { "GET", "POST" }, propertyPrivate = true) })
@Service(Servlet.class)
public class TestServlet extends SlingAllMethodsServlet{

/**
*
*/
private static final long serialVersionUID = 1L;

/** The Constant LOG. */
private static final Logger log = LoggerFactory.getLogger(TestServlet.class);

private static final String ORACLE_DATA_SOURCE = "brand";

private static  String queryString ="select table_name from all_tables";
   
   /** The query builder. */
  @Reference
   private ConnectionHelper  connectionHelper;
 
  /** @scr.reference policy="static" */
  private DataSourcePool dataSourceService;
DataSource dataSource = null;
Connection connection = null;
@Override
protected void doGet(SlingHttpServletRequest request,
SlingHttpServletResponse response) throws ServletException,
IOException {
try {
log.info("DATA_SOURCE   -->"+ORACLE_DATA_SOURCE);
connection = connectionHelper.getConnection(ORACLE_DATA_SOURCE);
log.info("connection-->"+connection);

//dataSource = (DataSource) dataSourceService.getDataSource("brand");
final ResultSet resultSet = connection.createStatement().executeQuery(queryString);
log.info("ResultSet : " + resultSet);

} catch (Exception e) {
log.error("Exception from DOGET in test servelt {}", e.getStackTrace());
e.printStackTrace();
//e.getStackTrace();

} finally {
if(null!=connection){
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}

}
}

}




Hi,

Trying to connect oracle through AEM 6.2 and I am facing this error,

Can somebody help me understand the below error   "Not an instance of DirContext", why this error is throw when trying to establish connection,



SQLException in getting connection java.sql.SQLRecoverableException: IO Error: JNDI Package failure javax.naming.NotContextException: Not an instance of DirContext,IO Error: JNDI Package failure javax.naming.NotContextException: Not an instance of DirContext

Thanks

Vetrik
I am trying to integrate IIS and tomcat. I have IIS on windows 2003 (machine 1) and tomcat 6 (machine 2). I need more information on configuration... the ISAPI dll is not loading in machine 1. I have some basic doubts too,

1. where should the DLL placed ? in machine 1 or machine 2
2. How to configure my application , s the redirect will pick my application.

Can you send me the steps , that would be of great help.


Thanks,
Vetrik
15 years ago
Hi,

Found this thread to be interesting, I am facing similar problem, my application has 200 as thread queue and when this problem occurs , I was not even able to get into the console.

Could any one of you help me in solving this ?

If tuning in the database is required, what kind of tuning is to be made. I would appreciate your early response.

-- Vetrik
18 years ago
Can I synchronize the connection object?

If I do what are the advantage and disadvantages?

Or the connection object should never be synchronized.........

If yes, is there a good approach to implement the same....

I think even the close() will enable the garbage collection, correct me if I am wrong.

Hi,

See the following code, my question is can i assign null after closing the connection object or is it not the standard.

Connection conn = DriverManager.getConnection("url","user","pwd");

.
.
.

if(conn != null{

conn.close();
conn = null;

}

:-)


Hi Bajji,

Thanks for your reply , check the code below , was the problem due ot XMLReader or i am really missing anything.

SAXParserFactory spf = SAXParserFactory.newInstance();

spf.setNamespaceAware( true );
spf.setValidating( false );

SAXParser saxParser = spf.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setContentHandler( new ParseTXT() );

xmlReader.parse( new InputSource( new FileInputStream( new File( sXMLFilePath ) ) ));

Hi,

I am using sax parser (jdk 1.4.2), the problem is that, value between the tag which contains & is ignored
eg., <Name>Credit&Card</Name>
When i parse and try to retrive the value between
<Name> tag --- the value returned to is "Credit". actually iam expecting "Credit&Card". Need ur help, how to fix this issue

[ May 20, 2005: Message edited by: Vetrik Kumaran ]