Bonjour,
J'ai installé JDBC sur Intellij IDEA en vue de récupérer des données présentes sur une base mysql
Il s'agit d'une application Android, pour l'instant ma base se trouve sur l'ordinateur où je développe
Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
 
package com.example.prototype1;
 
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
 
import java.sql.Connection;
import java.sql.DriverManager;
 
/**
 * Created by Hatsrog on 23/02/2015.
 */
public class detailsAnalyse extends Activity
{
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.detailsanalyse);
        Intent intent = getIntent();
        String analyseText = intent.getStringExtra("analyseText");
        TextView intituleAnalyse =(TextView)findViewById(R.id.intituleAnalyse);
        intituleAnalyse.setText("Analyse :"+ analyseText.toString());
        TacheAsynchrone tacheAsynchrone = new TacheAsynchrone();
        tacheAsynchrone.execute();
    }
 
    public void activitePrecedente(View view)
    {
        super.onBackPressed();
    }
 
    private class TacheAsynchrone extends AsyncTask<Void, Integer, String> {
        @Override
        protected String doInBackground(Void... arg0){
            String string = "";
            Connection connection = null;
            try {
                Class.forName("com.mysql.jdbc.Driver");
                connection = DriverManager.getConnection("jdbc:mysql://192.168.1.70:3306/test", "root", "root");
            } catch (Exception e) {
                e.printStackTrace();
            }
 
            return string;
        }
 
        @Override
        protected  void onPostExecute(String result){
 
        }
    }
}
j'ai essayé de nombreuses choses, apparemment je n'ai pas touché au port par défaut de mysql (3306)
j'utilise mysql_connector_java_5_1_18

Lors du débogage, l’exception catch se déclenche ici :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
connection = DriverManager.getConnection("jdbc:mysql://192.168.1.70:3306/test", "root", "root");
Avec cette erreur :
Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

Merci pour votre aide