jdbc:mysql:www.phpmyadmin.toponitech.com:8080/mysql/non_Bd","login","mot de passe");
import java.sql.*; public class testConection { public static void main (String[] args) { //Connexion à un serveur Wamp sous Windows 2003 Server String url="jdbc:mysql:www.ciras.cg:8080/mysql"; String login="teste/non_base_donee"; String passwd="mot_passe"; Connection connexion; System.out.println ("Connexion au driver JDBC..."); try{ //DriverManager.setLogWriter(new PrintWriter(System.out)); Class.forName ("com.mysql.jdbc.Driver"); System.out.println ("Driver com.mysql.jdbc.Driver chargé"); connexion = DriverManager.getConnection (url, login, passwd ); System.out.println ("Driver com.mysql.jdbc.Connection effectué"); }catch (Exception ex){ System.out.println ("ERREUR: " + ex.getMessage ()); System.exit (1); } } }
The JDBC URL format for MySQL Connector/J is as follows, with items in square brackets ([, ]) being optional: jdbc:mysql://[host][,failoverhost...][:port]/[database] » [?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]... If the host name is not specified, it defaults to 127.0.0.1. If the port is not specified, it defaults to 3306, the default port number for MySQL servers. jdbc:mysql://[host:port],[host:port].../[database] » [?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]... If the database is not specified, the connection will be made with no default database.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question