Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 23rd, 2005, 07:05 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default java.sql.SQLException: [Microsoft][ODBC Driver Man

Hi i am getting the following

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

while executing the folloing program. I am using
Apache Tomcat 5.0.19 webserver & sel server as database.

Please Help me.
Thanks in advance.


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;

public class TomacatData extends HttpServlet{
    Connection con=null;
    Statement st=null;
    ResultSet rs=null;
    String qry=null;
    public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{
        PrintWriter out=res.getWriter();
      out.println("Hi hari");

    try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
             con = DriverManager.getConnection("jdbc:odbc:exonweb");
             st=con.createStatement();
             qry="SELECT cmpny_sCmpShortName, cmpny_sCmpName FROM CMPNY where cmpny_sCmpName like 'E%'";
             rs=st.executeQuery(qry);
             while(rs.next()){
                 System.out.println(""+ rs.getString(1));
                 System.out.println(""+ rs.getString(2));
            }
         }catch(SQLException e){
            System.out.println("Error in getConnection:"+e);
              }catch(ClassNotFoundException e){
                  e.printStackTrace();
              }
    }

}


 
Old May 5th, 2005, 02:40 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 345
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to gokul_blr Send a message via Yahoo to gokul_blr
Default

check whether ODBC driver jar file into web-inf lib folder


Gokulan Ethiraj





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLException in using odbc excel driver lironnezers Java Databases 2 December 20th, 2010 08:02 AM
[Microsoft][ODBC SQL Server Driver] TIME OUT ERROR rtr1900 ASP.NET 2.0 Basics 1 November 12th, 2008 09:36 AM
[Microsoft][ODBC SQL Driver]Connection is busy [email protected] Pro JSP 0 May 8th, 2006 07:51 AM
[Microsoft][ODBC Microsoft Access Driver] Syntax e chinedu Classic ASP Databases 3 November 18th, 2004 03:48 PM
java.sql.SQLException: Error loading JDBC Driver jdphjp Java Databases 1 August 5th, 2004 12:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.