whenever I m trying to set the connection with my database i get the following error:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Driver's SQLAllocHandle
on SQL_HANDLE_ENV failed
my code is:
import java.sql.*;
public class testconnection
{
public static void main(String ar[])
{
Connection conn;
Statement stmt;
ResultSet rs;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc
dbc:newdsn","scott","tiger");
stmt=conn.createStatement();
rs=stmt.executeQuery("select * from emp");
while(rs.next())
{
System.out.println(" "+rs.getInt(0)+" "+rs.getString(1));
}
conn.close();
}
catch(Exception e)
{
System.out.println(e);
}
}
}
my dsn name is:newdsn.
please help me to get out of this