hello
i am nireekshan i have some prouble in database connection
send my erres pless see and send Some Code .
//...............................//
import java.sql.*;
class Student
{
public static void main(String args[]) throws Exception
{
try
{
import java.sql.*;
class Student
{
public static void main(String args[]) throws Exception
{
try
{
String database="c:\\student.mdb";
String url="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=" + database + ";DriverID=22;READONLY=false";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:student");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select *from studtable");
while(rs.next())
{
int no=rs.getInt(1);
String name=rs.getString(2);
String address=rs.getString(3);
System.out.println(no+" "+name+" "+address);
}
System.out.println("connected");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
***************************************************************************************************************//in the above program was working Good ,not any arrer But Bellow Program was some arrer
##########################################################################
//
String database="c:\\student.mdb";
String url="jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=" + database + ";DriverID=22;READONLY=false";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection(url);
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select *from studtable");
while(rs.next())
{
int no=rs.getInt(1);
String name=rs.getString(2);
String address=rs.getString(3);
System.out.println(no+" "+name+" "+address);
}
System.out.println("connected");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Exception in thread "main" java.sql.SQLException:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified