aspose file tools*
The moose likes Oracle/OAS and the fly likes ORA-12519 with servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "ORA-12519 with servlet" Watch "ORA-12519 with servlet" New topic
Author

ORA-12519 with servlet

Lars Vegas
Greenhorn

Joined: Dec 04, 2001
Posts: 27
Hi,
I'm facing a strange behaviour on my tomcat webserver with a servlet. I'm using Oracle 10g as the database and try to access it with my servlet.
The doPost-method throws the following exception while trying to establish the connection to the RDBMS:

"SQLException:
Connecting not possible:
Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found The Connection descriptor used by the client was: localhost:1521 BTEN"

After starting my servlet, the connection to the database for other applications blocks with the same error message
for a few minutes. After these few minutes connecting to the database is possible again!!! Restarting the database and the listener also helps...



public void doPost( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException {

Connection conn = null;

response.setContentType( "text/html" );
PrintWriter out = response.getWriter();

String connStr = "jdbc racle:thin:@localhost:1521 BTEN";
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
}catch( ClassNotFoundException cnf ){
out.println( "CNFException: "+cnf.getMessage() );
}

//retrieve Connection
try{
conn = DriverManager.getConnection( connStr, "scott", "tiger" );
}catch( SQLException sqle ){
out.println( "SQLException: <BR> Connecting not possible: <BR> "+sqle.getMessage()+"<BR>" );
}

.....

}



When I put that part in a 'normal' main program everything is ok. I can connect to the database and access tables with select statements and everything is ok.



public static void main(String[] args) {

Connection conn = null;
//retrieve Connection
try{
String connStr = "jdbc racle:thin:@localhost:1521 BTEN";

try{
Class.forName("oracle.jdbc.driver.OracleDriver");
}catch(ClassNotFoundException cnf){
System.out.println( "CNFException: "+cnf.getMessage() );
}

conn = DriverManager.getConnection( connStr, "scott", "tiger" );

}catch( SQLException sqle ){
System.out.println( "SQLException:"+sqle.getMessage() );
}

.....

}


Does anyone have an idea what the problem is in this case?
I will also post in the Servlet forum
Regards,
Lars
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
The only thing I can think of is that maybe your stand-alone code and your servlet aren't hitting the same oracle JDBC driver library. Over the last couple of years I've seen info in Oracle docs talking about the shift from accessing the remote database via service name instead of SID; you may want to take a look at what you are doing to see if you are providing the SID or the service name. I wouldn't really expect a driver difference to cause you to trip over that, I'd have expected the listener to completely determine the result... but yet for some reason you aren't connecting. Nothing else is really coming to mind beyond trying to really make sure that you are using the current 10g JDBC drivers and make sure you are specifying the correct connection info.
[ January 31, 2006: Message edited by: Reid M. Pinchback ]

Reid - SCJP2 (April 2002)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"Lars Vegas"

Welcome to JavaRanch!

One of the few rules we have round here is that you use a real sounding user name. Our naming policy is found here. You can edit your name here.

Thank you, and enjoy JavaRanch!


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
Don't get me started about those stupid light bulbs.
 
subject: ORA-12519 with servlet
 
Similar Threads
Not Suitable Driver Error
Error in connetion pool driver.connect
cannot connect from servlet
Struts:DB Connection with Oracle
Help needed with error SQLException: ORA-00928: missing SELECT keyword