Hello All
I am looking for a way to connect Android without webservice in my H2,
I found this: http://h2database.com/p.html#6fc40e2f8bc1f11ef8881c796fbf9ce3
I am trying this
public class MyConnection{
public static Connection getConnection() {
Connection con = null;
try{
Class.forName("org.h2.Driver");
con =
DriverManager.getConnection("jdbc:h2:tcp://192.168.1.100:9001/
db/iguana","sa","sa");
}catch(ClassNotFoundException ex){
AlertDialog.Builder alert = new
AlertDialog.Builder(null);
alert.setMessage("Class not found : " +
ex.getLocalizedMessage());
alert.setNeutralButton("Ok", null);
AlertDialog dialog = alert.create();
dialog.setTitle("Error");
dialog.show();
}catch(SQLException ex){
AlertDialog.Builder alert = new
AlertDialog.Builder(null);
alert.setMessage("Connection Error: " +
ex.getLocalizedMessage());
alert.setNeutralButton("Ok", null);
AlertDialog dialog = alert.create();
dialog.setTitle("Error");
dialog.show();
}
return con;
}
}
public class IguanaBarAndroidActivity extends Activity {
private VendaProdutoDAO vpDAO;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
vpDAO = new VendaProdutoDAO();
}
}
Does not work, how to make ?
PS: I have not added h2.jar in my Android project, how to add h2.jar
in Android ?
thanks
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.