Forums Register Login

DriverManager not getting connection.

+Pie Number of slices to send: Send
Hi,

I am having a strange problem when i am using DriverManager API of oracle.My classes12.jar is from oracle10G.Currently my problem is whem i am trying to import 1000 records from an external CSV file into database it is failing with the following stack trace.

12:17:28,312 ERROR [STDERR] java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:273)
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:327)
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:360)
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:150)
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31)
12:17:28,312 ERROR [STDERR] at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:595)
12:17:28,312 ERROR [STDERR] at java.sql.DriverManager.getConnection(DriverManager.java:582)
12:17:28,312 ERROR [STDERR] at java.sql.DriverManager.getConnection(DriverManager.java:185)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.csv.CSVDAO.getConnectionFromDriver(CSVDAO.java:75)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.csv.CSVDAO.getConnection(CSVDAO.java:46)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.csv.CSVFieldValidator.ruleRemoteValue(CSVFieldValidator.java:500)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.csv.CSVValidator.validateData(CSVValidator.java:317)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.csv.CSVParser.loadFile(CSVParser.java:33)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.csv.CSVParser.parseCSV(CSVParser.java:86)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.session.csv.MpwCsvFilesHome.startImportFromCSVProcess(MpwCsvFilesHome.java:97)
12:17:28,312 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor1263.invoke(Unknown Source)
12:17:28,312 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
12:17:28,312 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:95)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:89)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
12:17:28,312 ERROR [STDERR] at com.vodafone.mpweb.session.csv.MpwCsvFilesHome_$$_javassist_6.startImportFromCSVProcess(MpwCsvFilesHome_$
$_javassist_6.java)
12:17:28,312 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor1262.invoke(Unknown Source)
12:17:28,312 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
12:17:28,312 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
12:17:28,312 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
12:17:28,312 ERROR [STDERR] at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
12:17:28,312 ERROR [STDERR] at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
12:17:28,312 ERROR [STDERR] at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
12:17:28,312 ERROR [STDERR] at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
12:17:28,312 ERROR [STDERR] at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
12:17:28,312 ERROR [STDERR] at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.ja
va:88)
12:17:28,312 ERROR [STDERR] at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
12:17:28,312 ERROR [STDERR] at javax.faces.component.UICommand.broadcast(UICommand.java:387)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.component.UIDataAdaptor.broadcast(UIDataAdaptor.java:1364)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
12:17:28,312 ERROR [STDERR] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
12:17:28,312 ERROR [STDERR] at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
12:17:28,312 ERROR [STDERR] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
12:17:28,312 ERROR [STDERR] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
12:17:28,312 ERROR [STDERR] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
12:17:28,312 ERROR [STDERR] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
12:17:28,312 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
12:17:28,312 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
12:17:28,312 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
12:17:28,312 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve
.java:126)
12:17:28,312 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.
java:70)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
12:17:28,312 ERROR [STDERR] at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
12:17:28,312 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
12:17:28,312 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
12:17:28,312 ERROR [STDERR] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
12:17:28,312 ERROR [STDERR] at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
12:17:28,312 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)


The point at which the exception is thrown is at the following statement "DriverManager.getConnection"

How ever the same works when i am importing 200 records.

I open and close the connection according to the validations to be done on each record of the csv file.I am not able to understand why this is happening.Please help me in this.
+Pie Number of slices to send: Send
Could you post your code as well. And please use code tags for codes and Error Stacks.
+Pie Number of slices to send: Send
Properties dataProperties = new Properties();
dataProperties.load(getClass().getClassLoader().getResourceAsStream(
"CsvSqlProperties.properties"));
dataProperties.getProperty(CSVSqlConstants.DRIVER_NAME);
dataProperties.getProperty(CSVSqlConstants.DRIVER_NAME);
String driverName = dataProperties
.getProperty(CSVSqlConstants.DRIVER_NAME);
String url = dataProperties.getProperty(CSVSqlConstants.URL);
String username = dataProperties.getProperty(CSVSqlConstants.USERNAME);
String password = dataProperties.getProperty(CSVSqlConstants.PASSWORD);
Class.forName(driverName);
Connection connection = DriverManager.getConnection(url, username,
password);
connection.setAutoCommit(false);


I read the the database information from a properties file. Strange things observed were, it some times imports 300 records and gives exception i am not able to guess why it works perfectly for 200 records and only sometimes for 300 records.
+Pie Number of slices to send: Send
Please use code tags like this:


Is your url and IP like 10.xx.xx.xxx or something? Or are you using a DNS name?
+Pie Number of slices to send: Send
I am sorry. I am completely new to java ranch.

I have used an URLwith IP(like 10.23.34.56) and then tried using the hostname(like localhost or systemABC).
But either way it didnt work.

+Pie Number of slices to send: Send
Check this link...
http://forums.sun.com/thread.jspa?threadID=284032

and see if the info helps.
+Pie Number of slices to send: Send
Thanks for the link..

I had a look at all the posts in the forum. But my problem is a little different. i am able to conect to the Database and also perform the required operations but however the connection is good for 200 records and fails for 300 to 500 records.

I open a connection for each record and close it.

I need to do this to fire a select statement on the database.

Is there anything i am missing?
+Pie Number of slices to send: Send
That could be a heap issue.... Use the -xmx and -xms while running the code.
+Pie Number of slices to send: Send
 


My classes12.jar is from oracle10G


Why are you using this driver? Are you running your application on a 1.3 or lower JDK? And if so, why?
+Pie Number of slices to send: Send
No, we are using JDK 1.6. But however we are using basic JDBC calls for validating the CSV files. Using EJB 3.0 and Hibernate doesnot give us the entire flexibility of all the checking to be made and more over entity beans are much heavier we feel.

+Pie Number of slices to send: Send
 


No, we are using JDK 1.6.


Then I would upgrade your driver.


Using EJB 3.0 and Hibernate doesnot give us the entire flexibility of all the checking to be made and more over entity beans are much heavier we feel.


Entity beans and EJB3.0? EJB 3.0 does not include Entity beans. Also, this is a bit of an aside, but you are aware Hibernate (and other ORMs) allow you to run native SQL? You may be throwing the baby out with the bathwater, as they say.
He does not suffer fools gladly. But this tiny ad does:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1844 times.
Similar Threads
hibernate exception thrown from @Factory method
SerializationException: could not deserialize
Hibernate: org.hibernate.AssertionFailure: null id don't flush the Session after an exception occurs
Seam: Misterious ClassCastExceptions during EJB use
Rich:tree and managing expand/collapse from first load
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 07:18:31.