Bonjour,
Après avoir bataillé pour installer le module DBI et DBD-mySQL, j'ai enfin trouvé comment faire mon script.

J'ai cependant des erreurs à l'execution, mais pas a la compilation.

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
 
##### ouverture session #####
Content-type: text/htmlnnDBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for
 the right syntax to use near ')' at line 1 at F:/export_data_sql_V4.pl line 302.
 
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'VALUES (2014-6/3/11/29 )' at line 1 at F:/export_data_sql_V4.pl line 308.
 
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near ')' at line 1 at F:/export_data_sql_V4.pl line 302.
 
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'VALUES (2014-6/3/11/29 )' at line 1 at F:/export_data_sql_V4.pl line 308.
 
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near ')' at line 1 at F:/export_data_sql_V4.pl line 302.
 
DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near 'VALUES (2014-6/3/11/29 )' at line 1 at F:/export_data_sql_V4.pl line 308.
je pose aussi la partie code des requetes :

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
 
sub session () 
 
    {
 
		#Chemin d'acces aux adresses des IP Serveur, à modifier au besoin
		my @servers = make_servers_list('F:/adresses_ip.txt'); 
		my %params = make_params_list();
		my $time = get_time();
 
		foreach (@servers)
 
		{
			my $connection = start_connection($_);
			my $dbh = start_connection_sql($_);
			next unless ($connection);
			my %values = get_values($connection, %params);
 
			# log_write(%values);
			end_connection($connection);
                                foreach (@servers)
 
			{
 
			my $query = "INSERT INTO puissance( ID_Compteur, Puissance_P, Puissance_Q, Puissance_S, Dephasage) VALUES (";
		  		foreach (keys %values) 
				{ 
		        	$query .= $values{$_}.", "; 
		   		} chop; chop;
				$query .= " )"; 
 
	$sqlQuery  = $dbh->prepare($query) or die "Can't prepare $query: $dbh->errstrn";
	$sqlQuery->execute(); 
 
	$query = "INSERT INTO puissance(Date VALUES (".$time." )"; 
 
	$sqlQuery  = $dbh->prepare($query) or die "Can't prepare $query: $dbh->errstrn";
 
	$sqlQuery->execute(); }
	}
}

Les requetes me paraissent bonnes, et la compile marche, du coup, je suis en galère pour mon script, j'ai tenté pas mal de versions mais pas d'avancée . . .

Merci pour votre aide

Ju