Question

J'ai une application qui utilise java et se pendant le codage, j'installé établi MySQL sur localhost, tout fonctionne bien. Maintenant, je dois distribuer les fichiers jar afin que les gens puissent l'utiliser. mais quand j'essayez d'accéder à la base de données, il indique une erreur de connexion. Dans le chemin de la base de données que j'ai remplacé localhost par l'adresse IP de l'ordinateur la base de données est activée. Est-ce que quelqu'un pourrait m'aider s'il vous plaît.

Merci beaucoup

Était-ce utile?

La solution

  1. As you know, for JDBC in general, you need to specify the host in your connection string.

  2. As you also know, you typically specify the driver in Class.forName(), and the driver's .jar directory in your Java CLASSPATH.

  3. You're probably using the MySql/J connector - I believe that's all your client needs deployed along with your application.

  4. You also need to make sure the mySql port (default 3306) is open.

  5. Mysql "users" are defined and authorized on a per-host basis. You'll also need to make sure this is set up correctly in your "Users" mysql table.

  6. Be sure your application logs all available exception information. Please post any specific error messages here.

'Hope that helps

PS: The only relevance to "mysql workbench" is that your app happens to work when you run it locally, using mysql workbench, correct? If so, it probably isn't a good tag for this question...

Autres conseils

Run the query on the DB as admin user.

GRANT ALL ON db1 TO 'jeffrey'@'%';

Assuming that db1 is your schema and jeffrey is the user you want to give access to.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top