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();
}
}
}
|