import java.sql.*;
public class Mysqlc
{
public static void main(String[] args)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:mysqljava", "root","123" );
Statement s = con.createStatement();
s.executeQuery("SELECT * FROM pet");
ResultSet rset=s.getResultSet();
while(rset.next())
{System.out.println(rset.getString("name"));
}
}
catch(ClassNotFoundException exp)
{
System.err.println(exp);
}
catch(SQLException exp)
{System.err.println(exp);
}
}
}