• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

whats that java.sql.SQLException

 
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
 
Sheriff
Posts: 67266
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!