0 Replies Latest reply on Apr 22, 2010 11:26 AM by dhifallah

    Incorrect database name

    dhifallah

      I'm trying to connet to my database , but i have this error:

      com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Incorrrect database name

       

      my code is the following:

       

       

      import java.io.*

      import java.sql.*;

      import javax.servlet.*;

      import  javax.servlet.http.*;

       

       

      /**

       

      * Servlet implementation class MiseAJourDataBase

       

      */

      */

       

       

      public class ServletTest extends HttpServlet {

       

      private static final long serialVersionUID = 1L;

       

       

      /**

       

      * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse

       

      * response)

       

      */

       

      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

      doPost(request, response);

       

      }

       

       

      /**

       

      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse

       

      * response)

       

      */

       

      protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

      System.

      out.println("MySQL connexion essaie.");

      Connection con = null;

      String url = "jdbc:mysql://10.0.10.33:3306/Supportweb/supportweb/gestion_environnement";

       

      String driver = "com.mysql.jdbc.Driver";

      String user = "*********";

      String pass = "********";

       

       

      try {

      Class.forName(driver).newInstance();

      con = DriverManager.getConnection(url , user, pass);

      System.

      out.println("connected to database");

      con.close();

      System.

      out.println("disconnected from database");

       

       

      }

      catch (Exception e) {

      e.printStackTrace();

      System.

      out.println("no connexion");

      }

       

       

      }

       

      }

       

       

       

      can you help me please , i don't know how to resolve this problem

       

      can you help me please , i don't know how to resolve this problem