I've just installed DB2 v7.1 and am trying to create a simple servlet to
test the driver. I have some code that works perfectly well as an
application, but a soon as I try the same in a servlet, it does not
work.
public void doGet (HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException{
PrintStream out = new PrintStream (response.getOutputStream());
Connection conn = null;
Statement stmt = null;
response.setContentType ("text/html");
try {
// register the driver with DriverManager
// The newInstance() call is needed for the sample to work with
// JDK 1.1.1 on OS/2, where the Class.forName() method does not
// run the static initializer. For other JDKs, the newInstance
// call can be omitted.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");//.newInstance();
} catch (Exception e) {
e.printStackTrace(out);
}
try {
// Get a DB connection from the Broker
//for (int i = 0 ; i <= 10000; i++);
String url = "jdbc:db2:sample";
String user = "like";
String pwd = "duh!";
conn = DriverManager.getConnection(url, user, pwd);
The error give is:
Error code: java.sql.SQLException: No suitable driver
Can anyone tell me what I'm doing wrong here ??
sven
--
-------------------------------------------------------------------------------------------
Sven E. van 't Veer Afiliado
Universo Online
Gerente Desenvolvimento
Brasil Inform�tica e Telecomunica��es Ltda.
http://www.brvip.com.br
http://www.uol.com.br
-------------------------------------------------------------------------------------------
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html