前置工作 1. 安裝 TomCat 2. 下載及安裝 AppServ2.5.10.exe 內含 Appache 2.2/Php5/MySQL 3. 修改相關參數檔 Appache 2.2/conf/ httpd.conf, workers.properties TomCat/conf/server.xml.

Slides:



Advertisements
Similar presentations
DIR-636L Support 10/100/1000Mbps 1WAN and 4LAN N 300Mbps Wireless Easy wizard setup Support mydlink cloud service mydlink apps (iOS/android) Support.
Advertisements

Homework - Chapter 03 Solution.
IPhone/Android & MySQL Hongsheng Lu CSE40333/ Spring University of Notre Dame.
Proxy Mobile IPv6 for NS2.29 TA: 洪敏書
PowerPoint2010 李燕秋 版面配置 版面配置指的是每一個頁面的內容配置 方式,不同的版面配置會有對應的母片。
目的 「升學調查系統」,幫助某一學校調查並記錄 其歷屆畢業生報考研究所的情況、未來提供給 學弟妹作參考,以及學校推廣之相關工作。 功能需求 紀錄並追蹤歷屆畢業生升學的狀態 協助畢業生做升學輔導 未來提供學弟妹作查詢、參考 計算上榜率、前十大學校上榜率.
Proxy Mobile IPv6 for NS2.29 TA: 洪敏書
ECLIPSE NTHU CS /04/22. Outline Eclipse Installation Edit/Compile/Run the Java programs Java Document Generator.
Mobile IP Lab TA: 洪敏書
NCCU System 學校信箱. Let’s start from here: 從首頁的信箱入口進入.
1 第一章 Word 的基本觀念 內容概要: Word 的特色 啟動與離開 Word 的方法 滑鼠游標與外型的介紹 基本操作 Word 視窗法則 使用 Word 遭遇問題時, 應如何利用軟體特 性而獲得輔助解說.
Android Class vs. Jar 建國科技大學 資管系 饒瑞佶 2013/4 V1. 從 MyAndroidProject 專案改起 將 BMI_method.java 改寫成 class 方式 步驟 1 :在原 package 內新增一個 class.
Word 進階 Speaker : Kuo Tung Yang Date: 2008/12/10.
MS-DOS 作業系統 張基昇 (Microsoft-Disk Operating System).
程式語言實習 - JAVA Class1 1. 介紹 Java 編寫、編譯、執行 2. 請同學完成作業二.
程式註解說明. 2 程式註解格式 塊狀註解 對檔案、 class 、 method 、資料結構、一段程式 …. 等程式區塊 做說明。 第一行的開頭必需為 “/*” 且沒有其他文字,最後一行的開頭 必需以 “*/” 做為結束,在中間每一行的開頭都必需是一個 “*” 。 單行註解 佔據一整行的說明。 以.
CH 20-系統可靠度(System Reliability)
1 Introduction to Java Programming Lecture 4 Using JOptionPane Spring 2008.
嵌入式系統概論 - 以 S3C2440 核心為架構 第 15 章 嵌入式 Linux 核心 與根檔案系統.
Introduction to Java Programming Lecture 5: Using Java Classes : String & Math Spring 2009.
Introduction to pointers in C/C++. Pointers 特殊變數 存放變數在記憶體中的位址 MinGW C++ 中佔用 4 bytes 間接定址取執法 位址 指標變數 變數內容 變數.
1 MySQL 資料庫的使用 網頁資料庫的基礎 網頁資料庫的基礎 下載與安裝 MySQL 下載與安裝 MySQL 啟動 MySQL 伺服器 啟動 MySQL 伺服器 Web 介面的 MySQL 管理程式 Web 介面的 MySQL 管理程式 MySQL 建立資料庫 MySQL 建立資料庫 在 MySQL.
各種線上電子資源的特異功能 SwetsWise 的 alert, TOC alert 與 Favorites 2003/4/28 修改.
EBooks 使用手冊. eBook Features 每本書可同時 6 人閱讀 每本書閱讀時間為 2 小時 全文閱讀器為 DX Reader ( 不需下載安裝 ) 提供個人化功能: Highlights ( 畫重點 ) Annotations ( 加註解 ) Bookmark ( 書籤 ) Research.
下載 Dev C++ Compiler. 網址 ding.php?groupnamehttp://sourceforge.net/project/downloa ding.php?groupname=dev-cpp & filename=devcpp _setup.exe.
MinGW 的安裝.
國立聯合大學 資訊管理學系 陳士杰老師 MySQL 資料庫執行環境管理. 國立聯合大學 資訊管理學系 資料庫系統課程 ( 陳士杰 ) ▊ Outlines MySQL 資料庫系統的環境簡介 my.ini 簡介與製作 設定管理者的密碼.
2010 MCML introduction 製作日期: 2010/9/10 製作人 : 胡名霞.
OpenGL in C#.
09810ENGI 校園網頁服務介紹 講師 : 張智宏. Outline 校務資訊系統  教學意見  密碼維護  校園軟體下載 網路系統組  網際網路服務  學生宿舍網路  無線網路  新生入學  線上服務.
Linguistics phonetic symbols. 先下載 IPA 字型檔案,執行安裝。 由於這個程式的字型目錄設定錯誤, 所以等重新開機時就會發現字型消失。 所以必須根據以下步驟來讓 Windows 加入 IPA 字型。
簡易的 JBoss 安裝與部署. 安裝 Step 1 下載 J2SE JDK 5.O 並安裝 下載 JBoss 並解壓縮 (.zip 檔 )
1 Introduction to Java Programming Lecture 6 Program Input : BufferedReader & Scanner.
Hung-Hsiang WuWindows Processing Design1 Chapter10 資料庫元件應用二 Table and Query 元件不同處: 提供 SQL (Structured Query Language) 語法 各種資料庫軟體大都支援 SQL 語法  Oracle 、
Biological Science Database 個人化服務設定步驟. Biological Science Database 僅提供專題選 粹服務 專題選粹 (Alerts) :查詢後,提供儲存檢 索策略的功能,日後每週將符合條件的 更新資料,採 方式通知。每筆設定 最多每週可收到.
Quiz #3. 6.Show the final output of the program execution given in Fig.1. public class A{ int x=1;  實體變數 public int m01(int y){ int x = 3;  區域變數 return.
1 EndNote 金珊資訊有限公司 2 EndNote X2 新功能 新增標籤 (Tab) 視窗 線上查詢群組 智慧群組 (Smart Groups) 新增參考文獻類型 查詢全文 標示日期 以電子郵件傳送壓縮的 Library 檔案 Library.
如何使用 Yahoo Messenger Yahoo Messenger 雅虎即時通 讓你在第一時間內和上線的朋 友溝通!
09610CS_ 校園授權軟體下載與安裝 講師 : 張智宏. 登入校務資訊系統 校園軟體下載.
Visual C++重點複習.
1 CH 20- 系統可靠度( System Reliability )  系統組合型式  可靠度分析  提昇系統可靠度之可行策略  習題.
著作權所有 © 旗標出版股份有限公司 第 14 章 製作信封、標籤. 本章提要 製作單一信封 製作單一郵寄標籤.
The Java Remote Method Invocation (RMI) – 遠端方法呼叫 Reference: Java 學習手冊 p.p. 381 井民全製作.
如何 deploy JSP 到 Tomcat 井民全 製作. 系統需求 Apache Ant ( Apache Ant ( 負責編譯與製作 war 檔 負責編譯與製作 war 檔 Apache Tomcat.
HTTP and Threads. Download some code I’ve created an Android Project which gives examples of everything covered in this lecture. Download code here.here.
SQL CE. 註冊 RDA REGSVR32 IIS 設定 新增虛擬目錄 IIS 設定 輸入虛擬目錄名稱.
Console Input. So far… All the inputs for our programs have been hard-coded in the main method or inputted using the dialog boxes of BlueJ It’s time to.
HTTP and Threads. Getting Data from the Web Believe it or not, Android apps are able to pull data from the web. Developers can download bitmaps and text.
作者: WEBCOLLAB 日期: 2007/11/22 Content Management Systems 實例簡介.
.NET + SQL SERVER SQL Server +SP4. 確定加入六個參考.
自由軟體實驗室 設置 Hadoop 環境 王耀聰 陳威宇 國家高速網路與計算中心 (NCHC)
靜宜大學資管系 楊子青 1 Working with Databases (II) 靜宜大學資管系 楊子青
UNIT 30 네트워크 전송 2 로봇 SW 콘텐츠 교육원 조용수.
非同步互動式網頁程式設計 - 實作練習 I 資料表的 CRUD - 使用 HTML/CSS & JavaScript 報告人: Dennis ( 嚴志和 ) 日期: 2014/11/10.
暑期專題進度. import java.io.*; import java.util.*; import javax.comm.*; public class SimpleRead implements Runnable, SerialPortEventListener { static CommPortIdentifier.
1 Network Simulator 2 Install Chao-Ying Chiu. 2 Outline n Install Cygwin n Install NS2 n Test NS2 Example.
演示场景. 类图 配置 HibernateApplicationContext.xml hibernate.cfg.xml 创建数据库 – ooad/ooad 关于 Library/Project 模板.
1 IPTABLES and NAT on Fedora Core 6 Speaker : Rex Wu Date :
Using Sequence Files. Mahout Installation – wget distribution-0.9.tar.gz
Adding network connections. Connecting to the Network To perform the network operations, your application manifest must include the following permissions:
WebForm 實例 (ASP.NET) 台南市教育局網路中心 在職教師校務行政系統程式 開發進階班 行政網路組.
Android aplikacija i baze podataka
標題版面配置 副標題. 標題及含清單的內容版面配置 ▪ 在此新增您的第一個項目符號 ▪ 在此新增您的第二個項目符號 ▪ 在此新增您的第三個項目符號.
.NET SQL SERVER SQL Server +SP4.
Adapter Pattern Context:
資料庫管理作業(一).
Pentaho Data Integration
MySQL安裝&操作教學.
.NET + SQL SERVER SQL Server +SP4.
Presentation transcript:

前置工作 1. 安裝 TomCat 2. 下載及安裝 AppServ exe 內含 Appache 2.2/Php5/MySQL 3. 修改相關參數檔 Appache 2.2/conf/ httpd.conf, workers.properties TomCat/conf/server.xml 4. 在安裝目錄下之 www 目錄內新增一個 uploads 目錄

5. 將 login.php 及 GetRecord.php 置入 www 目錄內 login.php: 登錄用 GetRecord.php: 上傳及執行 SQL 用

Login to MySQL public void login(View view){ try{ db=txtDb.getText().toString(); username = txtUser.getText().toString(); password = txtPswd.getText().toString(); sql=txtSql.getText().toString(); String link=urlText.toString()+"login.php";

String data = URLEncoder.encode(“db”, “UTF-8”) + “=” + URLEncoder.encode(db, “UTF-8”); data += “&” + URLEncoder.encode(“username”, “UTF-8”) + “=” + URLEncoder.encode(username, “UTF-8”); data += “&” + URLEncoder.encode(“password”, “UTF-8”) + “=” + URLEncoder.encode(password, “UTF-8”); data += “&” + URLEncoder.encode(“query_string”, “UTF-8”) + "=" + URLEncoder.encode(sql, "UTF-8");

URL url = new URL(link); URLConnection conn = url.openConnection(); conn.setDoOutput(true); conn.setConnectTimeout(30000); OutputStreamWriter wr = new OutputStreamWriter (conn.getOutputStream()); wr.write( data ); wr.flush(); BufferedReader reader = new BufferedReader (new InputStreamReader(conn.getInputStream()));

StringBuilder sb = new StringBuilder(); String line = null; // Read Server Response while((line = reader.readLine()) != null) { sb.append(line); break; } result=sb.toString(); res.setText("Login Successful");

Download mysql table lists txtSql.setText("show tables"); sql="show tables"; execSQL(sql); parseData(result); }catch(Exception e){ res.setText("Err "+e.getMessage()) ; blLog=false; }

Sub Function: execSQL(sql) private void execSQL(String sql){ try{ strUrl=urlText.toString(); username = txtUser.getText().toString(); password = txtPswd.getText().toString(); txtResult.setText(""); sql=sql.toLowerCase(); db=txtDb.getText().toString(); result = DBConnector.executeQuery(sql,strUrl,db,username,passw ord);

res.setText("SQL Command successful"); txtResult.setText(result); } catch(Exception e) { Log.e("log_tag", e.getMessage().toString()); result=null; res.setText("Failed"); }

Sub Function: parseData(result) private void parseData(String result){ try{ //res.setText(sql); ParseJsonData pjd=new ParseJsonData(recType); int no=pjd.calComma(result)+1; FldNo=no; Fld=new String[no]; pjd.getFldName( result,Fld,FldNo); sql=txtSql.getText().toString(); sql=sql.toLowerCase();

if(sql.startsWith("show create table")){ JSONArray jsonArray = new JSONArray(result); JSONObject jsonData = jsonArray.getJSONObject(0); txtResult.setText(jsonData.getString(Fld[1])); } if(sql.startsWith("select ")){ addFldSpin(spnFld); } int b=sql.compareTo("show tables"); if(b==0){ int rn=pjd.calRecord(result); tblAry =new String[rn]; recData=new String[rn][FldNo]; pjd.getRecord(result,Fld,recData);

for(int ri=0;ri<rn;ri++){ tblAry[ri]=recData[ri][0]; } addTblSpin(spnTbl); } } catch(Exception e) { Log.e("log_tag", e.getMessage().toString()); result=null; res.setText("Failed"); }

Class: DBConnector import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.HTTP;

public class DBConnector { public static String executeQuery(String sql,String strUrl,String db,String user,String pswd) { String result = ""; try { HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(strUrl+"GetRecord.php"); ArrayList params = new ArrayList (); params.add(new BasicNameValuePair("db", db)); //OK params.add(new BasicNameValuePair("username", user)); //OK params.add(new BasicNameValuePair("password", pswd)); //OK params.add(new BasicNameValuePair("query_string", sql)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));

HttpResponse httpResponse = httpClient.execute(httpPost); //view_account.setText(httpResponse.getStatusLine().toString() ); HttpEntity httpEntity = httpResponse.getEntity(); InputStream inputStream = httpEntity.getContent(); BufferedReader bufReader = new BufferedReader(new InputStreamReader(inputStream, "utf-8"), 8); StringBuilder builder = new StringBuilder(); String line = null; while((line = bufReader.readLine()) != null) { builder.append(line + "\n"); }

inputStream.close(); result = builder.toString(); } catch(Exception e) { // Log.e("log_tag", e.toString()); } return result; }