An SQL EXCEPTION is being caught saying "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified". I have used the same connecting code in swings, in which the code was executing perfectly including SQL statement execution. Please help me if any changes can be made to the code.
import javax.servlet.*;
import java.io.*;
import java.sql.*;
import javax.servlet.http.*;
public class forwardeg23 extends HttpServlet
{
Statement st;
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException,IOException
{
PrintWriter out = res.getWriter();
out.println("this is from forwardeg23");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:mysqllatest","root","tiger");
out.println("Atleast Connection Established");
st = con.createStatement();
}
catch(Exception ef){out.println(ef+"\n Error in creating connection");}
try{
st.executeUpdate("INSERT INTO student(Name,Marks) VALUES ('ABC',85)");
}
catch(Exception af){out.println("Exception HERE");}
}
}