[英]Android app connectivity to remote database in Derby
I am trying to connect an android app to a derby database on a pc to get data form that. 我正在尝试将android应用程序连接到pc上的derby数据库,以获取数据形式。 For this i googled a database specially for this purpose ie Awake SQL .
为此,我专门为此搜索了一个数据库,即Awake SQL 。 I tried the following code for the connection to the derby database.
我尝试了以下代码来连接derby数据库。 The code is of a function which is called on the button click of the android app.
该代码是在android应用程序的按钮单击时调用的函数。
public void getData(View view)
{
new Thread()
{
public void run()
{
String url = "jdbc:derby://localhost:1527";
String username = "user";
char [] password = {'p', 'a', 's', 's', 'w', 'o', 'r', 'd', '1'};
try
{
Connection connection
= new AwakeConnection(url, username, password);
}
catch(Exception e)
{
System.out.println(e);
}
}
}.start();
}
Actually this code was given in the user guide of Awake SQL. 实际上,这些代码是在Awake SQL的用户指南中给出的。 When i run the above code i get the debugging mode of the eclipse.
当我运行上面的代码时,我得到了Eclipse的调试模式。 I cant get any error in the console.
我无法在控制台中得到任何错误。 I am not sure if i am doing it right or not.
我不确定我是否做对了。 I am still unable to connect the database for the android app.
我仍然无法连接Android应用程序的数据库。
在http://www.awake-sql.org/上,我没有看到Derby被列为受支持的数据库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.