• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Connecting with MySQL withou use WebService ?

I am looking for a way to connect with MySQL without use WebServices, using only JDBC driver connector.

My Android app only works in local network(wireless) and I don't wanna used webservice.

I'm trying this.
Code:
public class MyConnection {  
    private static Connection con;  
      
    public static Connection getConnection() {    
        try{  
            Class.forName("com.mysql.jdbc.Driver");  
            con = DriverManager.getConnection("jdbc:mysql://localhost:3306/banco,user,pass");  
        }catch(ClassNotFoundException ex){  
            Toast.makeText(null, ex.getLocalizedMessage(), Toast.LENGTH_SHORT);  
        }catch(SQLException ex){  
            Toast.makeText(null, ex.getLocalizedMessage(), Toast.LENGTH_SHORT);  
        }  
        return con;   
    }  
}  


public class IguanaBarAndroidActivity extends Activity {  
    /** Called when the activity is first created. */  
    @Override  
    public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.main);  
  
        Connection con = MyConnection.getConnection();  
    }  
}

In manifest file I added this: <uses-permission android:name="android.permission.INTERNET"/>

How do this ? Any idea ?

thanks.
 
If you cant access the Web, how do you intent to access the database? I dont understand. Where is the database stoted?
 
Back
Top Bottom