Código PHP:
public Conectar () {
try
{
String sDBUrl = "jdbc:mysql://localhost/autos";
int num;
int num2;
DriverManager.registerDriver(new org.gjt.mm.mysql.Driver());
Connection cn = DriverManager.getConnection(sDBUrl,"autos","autos");
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery ("select * from ciudad ");
num = 0;
num2 = 1;
while (rs.next())
{
System.out.println (rs.getString (2));
grCiudad.getModel().setValueAt(rs.getString (2), num,0);
num = num + num2;
}
cn.close();
st.close();
} catch (SQLException e)
{
}