Good day,
Im currently creating an android program that would connect SQL Database remotely... Im using XAMPP from another computer.. and here is my code to connect: (mysql-connector already imported)
String url = "jdbc:mysql://xxx.xxx.x.xx:3306/mydatabase?allowMultiQueries=true&useOldAliasMetadataBehavior=true";
String user = "root";
String password = "mypassword";
int a = 0;
try
{
Class.forName("com.mysql.jdbc.Driver");
a = 1;
Connection con = DriverManager.getConnection(url, user, password);
a = 12;
Statement st = con.createStatement();
a = 123;
ResultSet rs = st.executeQuery("SELECT * FROM mytable");
a = 1234;
while(rs.next())
{
}
tDisplayS.setText("YES");
}
catch(Exception e)
{
tDisplayS.setText(a+"");
}
When I run my program.. I always get a catch of an error and only displays "1" ... what may seem to be lacking in this code? or Im doing it wrong, please help...
Thank you..