连接数据库的代码
public static String doGet(String url1) {
try {
URL url = new URL(url1);
HttpURLConnection Connection = (HttpURLConnection) url.openConnection();
if (Connection.getResponseCode() == 200) {
InputStream inputStream = Connection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder stringBuilder = new StringBuilder();
for (String line = ""; (line = bufferedReader.readLine()) != null; ) {
stringBuilder.append(line);
}
return stringBuilder.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}