Priti Satish Khandve
4 Answer(s)      3 years and 10 months ago
Posted in : JSP-Servlet
*while doing connectivity of jdbc with servlet I m getting following error how can I solve it.
*database is saved in classes where .java and .class file is stored. 
*I have done settings of Odbc driver as follows
1)control panel-> administrative tools->ODBC driver->add ->Microsoft Access Driver(*.mdb)->finish->Typed source name->clicked on select- took respective path where database was saved-> ok->ok->ok.

***********My code is******** 
<form action="servlet/Samplem"method=GET>
Model No=<input type=text name=mdlno><br>
Mobile Name=<input type=text name=mblnm><br>
Price=<input type=text name=prc><br>
<input type=submit>
***************java code***************
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Samplem extends HttpServlet implements Servlet
    public void doGet(HttpServletRequest rq,HttpServletResponse rs)throws ServletException,IOException
        PrintWriter pw=rs.getWriter();

        PreparedStatement pst;

        pw.println("Class loaded");
        Connection cn=DriverManager.getConnection("jdbc:odbc:{Microsoft Access Driver(*.mdb)}");
        pst=cn.prepareStatement("insert into mobile values(?,?,?)");

        String Mdlno=rq.getParameter("mblno");
                    String Mbnm=rq.getParameter("mbnm");
        String price=rq.getParameter("price");



        catch(Exception e){pw.println("error"+e);}

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


View Answers

March 14, 2013 at 6:26 PM

Go through the link, may this will be helpful for you.

Database Connectivity in Servlet


March 16, 2013 at 2:01 PM

Hi problem with url this url jdbc:odbc:{Microsoft Access Driver(*.mdb)}

First set the datasoruce name in conntrollpannel->Administrative tools -> Datasource(ODBC) -> User DSN-> Add -> select the Microsoft Access Driver(*.mdb) -> finish -> enter some userdefine datasource name like msdsn -> ok.

and use that datasource name in url like


March 18, 2013 at 1:16 PM

i tried the program,but still the connectivity with database is not happening. The Driver is getting Loaded.

March 18, 2013 at 1:17 PM

Thank u for you solution

Related Tutorials/Questions & Answers:
JDBC-SERVLET  *while doing connectivity of jdbc with servlet I m.... ***********My code is******** <html> <body> <form action="servlet... class Samplem extends HttpServlet implements Servlet { public void doGet
JDBC-SERVLET  while doing JDBC connectivity with servlet my driver is getting load but its giving exception for connection that DSN name not found...:// Thanks
Expport data into CSV File using JDBC in Servlet
into CSV File using JDBC in Servlet   ... into CSV file using JDBC in Servlet. We have created  file ".... Step 1: Create a Servlet ""
Example  JDBC in Servlet examples.   Hi Friend, Please visit the following link: Servlet Tutorials Here you will get lot of examples including jdbc servlet examples. Thanks
JAVA  HOW TO CONNECT JDBC IN SERVLET AND HOW TO PREPARE WEB.XML   Hi Friend, Please visit the following links:
Java : Servlet Tutorials - Page 2
into CSV File using JDBC in Servlet In this section, you will learn how to export data into CSV file using JDBC in Servlet. We have created ... Java : Servlet Tutorials     
Sitemap Java Servlet Tutorial Section
data into CSV File using Servlet | Export data into CSV File using JDBC... Map | Business Software Services India Java Servlet Tutorial Section... is a Container | What is servlet? | Methods of Servlet |  Life Cycle