ASF Bugzilla – Attachment 24551 Details for
Bug 48214
JDBC DriverManager: no suitable driver found after context reload
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Servlet Source of Test Case
DBTestServlet.java (text/plain), 1.77 KB, created by
Rainer Frey
on 2009-11-17 07:24:28 UTC
(
hide
)
Description:
Servlet Source of Test Case
Filename:
MIME Type:
Creator:
Rainer Frey
Created:
2009-11-17 07:24:28 UTC
Size:
1.77 KB
patch
obsolete
>package com.inxmail.test; > >import java.io.IOException; >import java.sql.Connection; >import java.sql.DriverManager; >import java.sql.SQLException; > >import javax.servlet.ServletException; >import javax.servlet.http.HttpServlet; >import javax.servlet.http.HttpServletRequest; >import javax.servlet.http.HttpServletResponse; > > >/** > * Servlet implementation class DBTestServlet > */ >public class DBTestServlet extends HttpServlet >{ > private static final long serialVersionUID = 1L; > > > /** > * @see HttpServlet#HttpServlet() > */ > public DBTestServlet() > { > super(); > } > > > @Override > public void init() throws ServletException > { > String driver = getServletContext().getInitParameter( "jdbc.driver" ); > String url = getServletContext().getInitParameter( "jdbc.url" ); > String user = getServletContext().getInitParameter( "jdbc.user" ); > String pass = getServletContext().getInitParameter( "jdbc.password" ); > try > { > Class<?> driverClass = Class.forName( driver ); > log( String.format( "Class %s loaded by %s", driver, driverClass.getClassLoader() ) ); > } > catch( ClassNotFoundException x ) > { > log( x.toString(), x ); > } > Connection con = null; > try > { > con = DriverManager.getConnection( url, user, pass ); > log( "connection established: " + con.toString() ); > > } > catch( SQLException x ) > { > log( x.toString(), x ); > throw new ServletException( x.toString(), x ); > } > finally > { > if( con != null ) > try > { > con.close(); > } > catch( SQLException x ) > { > log( x.toString(), x ); > } > } > > } > > > /** > * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) > */ > @Override > protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, > IOException > { > // TODO Auto-generated method stub > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 48214
:
24550
| 24551