hi,
I got exception"NoClassDefFoundException" at the runtime of this java code.My DSN connection is correct,sql server is also properly work,when my project excuted on tomcat.but my beans are not executed properly inly becoz of this connection error.plz give the solution to overcome this problem.
In my project i create connection in one package and all related beans in other package.
package conn;//package
import java.sql.*;
public class ConnectionDB
{
Connection con = null;
public Connection getConnectionDB()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:hrm","sa","pass");
}
catch (Exception e) { e.printStackTrace(); }
return con;
}
public static void main(String args[])
{
Connection cc=null;
ConnectionDB c = new ConnectionDB();
cc = c.getConnectionDB();
if (cc != null)
System.out.println("connected");
else
System.out.println("not connected");
}
}