wood burning stoves 2.0*
The moose likes JDBC and the fly likes connection error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connection error" Watch "connection error" New topic

connection error

panindra nath

Joined: Jan 23, 2008
Posts: 6
HI,this my servlet code for retreiving contents from the database using ms-access......whenever i launch browser and type in the URL it throws an error

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

i defined a datasource as db2(settings - control panel - administrative tools-odbc-db2)
so what should be the remedy to this problem?


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

public class test extends HttpServlet
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException

PrintWriter pw = response.getWriter();
Connection connection=null;


connection = DriverManager.getConnection("jdbc dbc b2");
Statement st = connection.createStatement();
ResultSet rs = st.executeQuery("select * from emp");
catch (Exception e)
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41052
Not an answer to this question, but be aware that the JDBC/ODBC bridge is not safe for concurrent access (which is what a servlet environment does, unless you take steps to prevent it).

Ping & DNS - my free Android networking tools app
wood burning stoves
subject: connection error
Similar Threads
problem connecting to access
simple coding, still not working, may day!!!!
how to delete row in database?, pls help in my coding
Oracle9i Connectivity thru wsad5.o
servlet program , sql error in coding, helpppp