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

Apps Login form with jdbc connection

You need to stop posting multiple threads about the same topic. That is not allowed here. If you do not get an answer immediately, be patient. Also, stop relying on us for code. We are not obligated to write the application and you will not learning anything from us doing so. Sit down, write down (on paper) what it is you need to do and try to translate it into code. If you are not capable of doing something, then back-peddle and work on something easier.

If you are a newbie at android programming (and from the sound of it, you are a newbie at programming in general), you should NOT be doing a networking project. Start small.
 
hi am creating simple mysql database connection using jdbc in android.here am using dis coding part:
package com.example.login;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import android.app.Activity;
import android.os.Bundle;

import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;



public class LoginLayoutActivity extends Activity {

EditText un,pw;
TextView error;
Button ok;

private static final String url = "jdbc:mysql://localhost/xcart";
private static final String user = "root";
private static final String pass = "";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


ok=(Button)findViewById(R.id.btn_login);

ok.setOnClickListener(new View.OnClickListener() {



@Override
public void onClick(View v) {
// TODO Auto-generated method stub



try {

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, user, pass);

Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select firstname,lastname from xcart_customers");
while(rs.next()) {
Log.i("log_tag",
"firstname: "+rs.getString("firstname")+
"lastname: "+rs.getString("lastname")
);
}

} catch (Exception e) {
e.printStackTrace();
}
}
});
}
}
Here am does not having error in both my console and logcat...but nothing happeded in my android simulator..give me some solutons..why my emulator simple opened not worked for me..s when am clicked button means nothing happened in my emulator...
 
Back
Top Bottom