2012年8月26日 星期日

jdbc 無法連接資料庫




public static final String MYSQL_URL = "jdbc:mysql://sql09.freemysql.net:3306/";
public static final String MYSQL_DBNAME = "xxxx";
public static final String MYSQL_USERNAME = "xxxxx";
public static final String MYSQL_PASSWORD = "xxxxxx";

public ArrayList bookList() throws Exception
{

ArrayList results = new ArrayList();

try
{
String script = "SELECT id, number, URL FROM position";
Log.d("Mystic","script = " + script);

// This will load the MySQL driver, each DB has its own driver
Class.forName("com.mysql.jdbc.Driver");

// Setup the connection with the DB
connect = (Connection) DriverManager.getConnection(MYSQL_URL
+ MYSQL_DBNAME,MYSQL_USERNAME,MYSQL_PASSWORD);

Log.d("Mystic","connection is success");

}
catch(Exception e)
{
Log.e("Mystic","Exception");
e.printStackTrace();
throw e;
}
finally
{
Log.d("Mystic","Finally");
connect.close();
}
return results;
}





一直無法連線成功,印出例外訊息:android.os.networkonmainthreadexception

幾經波折,後來發現是下述問題!


http://flipper.pixnet.net/blog/post/36169513-android-3.0-%E7%99%BC%E7%94%9F-android.os.networkonmainthreadexception



2012年7月21日 星期六

Google Map API Key Exception


C:\Program Files\Java\jre7\bin>keytool -list -alias androiddebugkey -keystore de
bug.keystore -storepass android -keypass android
金鑰工具錯誤: java.lang.Exception: 金鑰儲存庫檔案不存在: debug.keystore



金鑰工具錯誤: java.io.FileNotFoundException: yourkeyname.keystore (存取被拒。)
java.io.FileNotFoundException: yourkeyname.keystore (存取被拒。)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at sun.security.tools.KeyTool.doCommands(Unknown Source)
        at sun.security.tools.KeyTool.run(Unknown Source)
        at sun.security.tools.KeyTool.main(Unknown Source)



Windows x64

請使用最高權限執行cmd 再按照各大網站教學

即可解決此一問題!

2012年2月12日 星期日

ID

11116
1i3cdo8ae90761c323edccddsa5et6fs84831

5ui8ai1abb0c9ee4bacb774bc16aoo0cf95e7


6 s4766e7a59561fd91bc3e3sb0r477u28s773


o 5b50c0t277a930cebaeu0ff9Metd4fd65b51


b ui6b1fc749f0a208c665bbai6Mf35f6ce140


6 o0d999175d80406c2c2ua2ai4e60t9538321

子建友
6 t3003f41f06bc139y9f1c1498d5rs7u311a4


1 3cfb7od9582d534797eu4a14fieMcfcMac6e

La
5 9832efsb0a6b545abft69u52c9fei8a8d838

May
c u247e8diaa6i85783bcd2cu3113b2f400cd8

咖啡
r 5247e7M2a9af5f229313u8u75f1a7088t220

凱彬
2 i7f3306d25436sadbe188cdf6i3de29u09b9

13
a u4b5cbso833840ecc06a2876doM742d69e11

麻糬
f u7dfb0t38447f002687822idbe4808fyf8c8

罵包
2 s860a1b4f6ff8M34949f80627b5u9dut5dcb