• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

whats that java.sql.SQLException

 
Vijay Nimkarde
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is this Exception occure .....Can you tell me what exactly the problem
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified



i wrote code as

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
public class NameOne extends HttpServlet
{

public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
try
{
Driver d=new sun.jdbc.odbc.JdbcOdbcDriver();
DriverManager.registerDriver(d);
Connection con=DriverManager.getConnection("Jdbc:Odbc:namedsn","","");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from nametab");
rs.next();
out.println(rs.getString(1));


con.close();

}
catch(Exception e)
{
out.println("EXC!!!"+e);
}
}
public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{
doGet(request,response);
}
}

and can you please send me code how to access simple string stored on database(table) like Microsoft access.and display (by servlet)at vijay.best4u@gmail.com I was trying from 3 days not getting so much frustration
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not exactly a Tomcat question, is it? Please take the time to choose the correct forum for your posts.

For more information, please read this.

This post has been moved to a more appropriate forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic