Have you put the msft jdbc driver in libs? Anyway, I wouldn't go this route at all, it is better to put databases behind web-servers and use http/SOAP for database access. If you goal is an admin utility I would consider terminal-server solutions so that you can use existing admin tools rather than writing low-level replacements fpr phones.
BR AR On Nov 11, 6:01 am, Nataraaj <[EMAIL PROTECTED]> wrote: > Hello guys, > > This is the code i wrote > > package com.android.DBConnection; > > import android.app.Activity; > import android.app.AlertDialog; > import android.content.Intent; > import android.os.Bundle; > import android.view.View; > import android.view.View.OnClickListener; > import android.widget.Button; > > import java.sql.*; > > public class DBConn extends Activity { > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > Button button = > (Button)findViewById(R.id.btnCheckDBConnection); > button.setOnClickListener(mCheckDBConnectionListener); > } > > private OnClickListener mCheckDBConnectionListener = new > OnClickListener() > { > public void onClick(View v) > { > // To send a result, simply call setResult() before your > setResult(RESULT_OK, (new > Intent()).setAction("DBConnection!")); > AlertDialog.Builder Aldg = new > AlertDialog.Builder(DBConn.this); > try{ > Aldg.setTitle("Check DB Connection"); > > Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); > Connection DBConnSQL = > DriverManager.getConnection("jdbc:sqlserver://kcp-tech-015\\SQLEXPRESS: > 1433;DatabaseName=CafetriaManagement","sa","sa"); > > if (DBConnSQL==null) > Aldg.setMessage("Not Connected"); > else > Aldg.setMessage("Connected"); > > //Statement stmt= > DBConnSQL.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, > //ResultSet.CONCUR_READ_ONLY) ; > //ResultSet rst = stmt.executeQuery("SELECT COUNT(*) > FROM SALE"); > //while (rst.next()) > //{ > // Aldg.setMessage(rst.getString(1)); > //} > > } catch (Exception ex) { > Aldg.setMessage("Error: " + ex); > } finally { > Aldg.show(); > } > } > }; > > } > > On Nov 10, 10:25 pm, Michael <[EMAIL PROTECTED]> wrote: > > > > > Maybe you could provide some sample code so we can figure out what > > you're doing?- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---