Application works in eclipse and stops working after generating JAR executable

Asked

Viewed 147 times

0

I am working on two apps here in the company that are giving me a certain headache for a reason that the solution should be simple but I am not able to locate the error, the two applications work normally within the eclipse, more when the . JAR and run the programs outside the eclipse it generates an error referring to the database.

The funniest thing is that one of the programs gives the same error but for the Oracle 11g database drive the other works Oracle 11g and gives problem in uncanaccess drive.

What can it be?


Problem was solved through the Denis comment, it was necessary to add the below statement in the code;

    Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Class.forName ("oracle.jdbc.OracleDriver");
  • 1

    http://answall.com/questions/20722/no-suitable-driver-found-em-conex%C3%A3o-de-database-in-java, check this case, also make sure the driver is inside the jar

  • 1

    Friend solved the two problems, thank you, updated the question.

  • I’ll post an answer so you know the question has been answered

1 answer

3


To be able to fix this problem it is necessary to register the driver to be used, for this it is necessary to use Class.forName("net.ucanaccess.jdbc.UcanaccessDriver"), this way the driver is loaded and you can open the connection smoothly

Browser other questions tagged

You are not signed in. Login or sign up in order to post.