NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

What's wrong with my ODBC connection error ?

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
tangara



Joined: 06 Sep 2009
Posts: 20

PostPosted: Thu Apr 19, 2012 5:08 am    Post subject: What's wrong with my ODBC connection error ? Reply with quote

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.
Back to top
jyeary



Joined: 21 Oct 2008
Posts: 605
Location: Simpsonville, SC

PostPosted: Thu Apr 19, 2012 6:37 pm    Post subject: Re: What's wrong with my ODBC connection error ? Reply with quote

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


John Yeary
____________________________
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo