Changement d'interface graphique
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.example.boidelov3;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.impossibl.postgres.api.jdbc.PGConnection;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class DatabaseConnection extends AsyncTask<Void, Void, PGConnection> {
|
||||
private static final String DB_URL = "jdbc:postgresql://82.65.214.214:5432/boidelo";
|
||||
private static final String USER = "Tux2543";
|
||||
private static final String PASSWORD = "6wa*teCnuxsG#grAc5HzC!Rh%#@c&";
|
||||
|
||||
@Override
|
||||
protected PGConnection doInBackground(Void... params) {
|
||||
PGConnection connection = null;
|
||||
try {
|
||||
// Code de connexion à la base de données PostgreSQL
|
||||
String url = DB_URL;
|
||||
String username = USER;
|
||||
String password = PASSWORD;
|
||||
connection = (PGConnection) DriverManager.getConnection(url, username, password);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
||||
protected void onPostExecute(Connection connection) {
|
||||
// Traitez le résultat de la connexion ici
|
||||
if (connection != null) {
|
||||
// Connexion réussie
|
||||
} else {
|
||||
// Échec de la connexion
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user