Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
swdev:android:database_mysql [2018/05/02 16:08] smayr [MainActivity] |
swdev:android:database_mysql [2018/05/02 17:22] (current) smayr |
||
---|---|---|---|
Line 1: | Line 1: | ||
= Database: MySQL = | = Database: MySQL = | ||
+ | == Using RESTful API == | ||
+ | |||
+ | == Using Java Connector (no API) == | ||
==== DB Connector ==== | ==== DB Connector ==== | ||
Download the appropriate Java database connector: | Download the appropriate Java database connector: | ||
Line 142: | Line 145: | ||
ListView lstProducts; | ListView lstProducts; | ||
TextView lblProgress; | TextView lblProgress; | ||
- | Map< | + | Map< |
@Override | @Override | ||
Line 214: | Line 217: | ||
} catch (SQLException connError) { | } catch (SQLException connError) { | ||
- | | + | msg = " |
- | connError.printStackTrace(); | + | |
} catch (ClassNotFoundException ex) { | } catch (ClassNotFoundException ex) { | ||
- | | + | msg = "A 'Class not Found' exception was thrown."; |
- | ex.printStackTrace(); | + | |
} finally { | } finally { | ||
try { | try { | ||
if (stmt != null) { stmt.close(); | if (stmt != null) { stmt.close(); | ||
} catch (SQLException ex) { | } catch (SQLException ex) { | ||
- | stmt.close(); | + | ex.printStackTrace(); |
} | } | ||
try { | try { | ||
if (conn != null) { conn.close(); | if (conn != null) { conn.close(); | ||
} catch (SQLException ex) { | } catch (SQLException ex) { | ||
- | conn.close(); | + | ex.printStackTrace(); |
} | } | ||
} | } | ||
Line 236: | Line 239: | ||
| | ||
| | ||
+ | |||
| | ||
+ | |||
if (mapProducts.size() > 0) { | if (mapProducts.size() > 0) { | ||
| | ||
- | | + | |
} | } | ||
} | } | ||
Line 350: | Line 355: | ||
See: [[https:// | See: [[https:// | ||
+ | |||
+ | |||
== References == | == References == | ||
See also: | See also: |