Hi,
whats wrong with you guys!!
Error 1.
---------
public class TestBean throws IOException, ClassNotFoundException {
^^^^^^ ^^^^^^
A class never throw an exception. Its methods and functions throw an
exception.
----------------------------------------------------------------------------
-------------------
Error 2.
---------
import java.sql.*;
public class TestBean {
===> try {
......}catch(......) {.....}
Solution: You have started using a try / catch blocks directly withing
class. It has to be sed withing a method.
----------------------------------------------------------------------------
-------------------
bye
Paras
----- Original Message -----
From: Atchutarao Killamsetty <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 31, 2000 7:28 PM
Subject: Re: Connection to a database - failure
public class TestBean {
should be replaced by
public class TestBean throws IOException, ClassNotFoundException {
/* Note : add the exceptions that my be thrown if ..... */
With regards,
Atchutarao Killamsetty,
http://karao.tripod.com/myjava.html
-----Original Message-----
From: Marcel van Kooy <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, July 31, 2000 7:24 PM
Subject: Connection to a database - failure
>Hi all,
>
>Can somebody please help me with this problem.
>When I compile this source-code, for making a connection to a database,
>I'll receive the error "type expected" in the first TRY-statement.
>How can I solve this and what does it mean?
>Thanks,
>Marcel van Kooy
>
>import java.sql.*;
>
>public class TestBean {
>
> try {
> Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> }
>
> catch( Exception e ) {
> System.out.println("Failed to load JdbcOdbcDriver.");
> return;
> }
>
> try {
> Connection con =
>DriverManager.getConnection("jdbc:odbc:Studio_Bezoekers", "", "");
> Statement select = con.createStatement();
> ResultSet result = select.executeQuery
> ("...A query...");
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets