[nbj2ee] Re: What's wrong with my ODBC connection error ?

  • From: John Yeary < >
  • To:
  • Subject: [nbj2ee] Re: What's wrong with my ODBC connection error ?
  • Date: Thu, 19 Apr 2012 14:14:55 -0400

Do you have a mySQL ODBC connection with the same name?
____________________________

John Yeary
____________________________ 
NetBeans Dream Team
President Greenville Java Users Group
Java Users Groups Community Leader
Java Enterprise Community Leader


____________________________ 

       

"Far better it is to dare mighty things, to win glorious triumphs, even though checkered by failure, than to take rank with those poor spirits who neither enjoy much nor suffer much, because they live in the gray twilight that knows not victory nor defeat."
-- Theodore Roosevelt



On Thu, Apr 19, 2012 at 1:09 AM, tangara < "> > wrote:
Hi forum,

I tried to use my ODBC connection in my servlet.

It works on a servlet but just wouldn't budge in another.


Code:

protected void doGet (HttpServletRequest request, HttpServletResponse response)
           throws ServletException, IOException {

       response.setContentType("text/html;charset=UTF-8");
       PrintWriter out = response.getWriter();
       Connection con = null;
       ResultSet rs = null;
       PreparedStatement ps = null;
       Statement stmt = null;

              try {
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               con = DriverManager.getConnection("jdbc:odbc:practicalODBC1");
            ArrayList students = new ArrayList();



The error message is :

incompatible types
required: com.mysql.jdbc.Connection
found : java.sql.Connection

The database I'm using is MSaccess and I have done the necessary configuration at the Administration control panel.

Hope somebody can advise me why.

Thanks.







[nbj2ee] What's wrong with my ODBC connection error ?

tangara 04/19/2012

[nbj2ee] Re: What's wrong with my ODBC connection error ?

John Yeary 04/19/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close