Football Fans: Download the 2012 Schedule App from Google Play!


Go Back   Android Forums > Android Development > Application Development

Application Development Dev Lounge for the Coder Folks



Reply
 
LinkBack Thread Tools
Old February 8th, 2012, 03:44 AM   #1 (permalink)
Junior Member
 
Join Date: Dec 2011
Location: chennai
Posts: 61
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default Login form with jdbc connection

how is connecting mysql database using jdbc in android...send me some links.

krishnaveni is offline  
Reply With Quote
Sponsors
Old February 8th, 2012, 05:07 PM   #2 (permalink)
Senior Member
 
Join Date: Jul 2010
Posts: 977
 
Device(s): Samsung Galaxy S II, HTC Evo 4G, Amazon Kindle Fire
Thanks: 52
Thanked 199 Times in 144 Posts
Default

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.
jonbonazza is online now  
Reply With Quote
Old February 14th, 2012, 06:10 AM   #3 (permalink)
Junior Member
 
Join Date: Dec 2011
Location: chennai
Posts: 61
 
Device(s):
Thanks: 1
Thanked 0 Times in 0 Posts
Default

hi am creating simple mysql database connection using jdbc in android.here am using dis coding part:
Quote:
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...
krishnaveni is offline  
Reply With Quote
Reply

Bookmarks


Go Back   Android Forums > Android Development > Application Development User CP
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 12:16 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Custom vBulletin Skins by: Relivo