Hi all members!

I tried to connect with MySQL in GWT but i couldn't there is this
exception:
            The method forName(String) is undefined for the type Class

there are my codes:

FIRST WAY:

                try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //there is first
driver
                String jdbc_name = "jdbc:odbc:mashhur"; //there is "mashhur" in
JDBC name
                Connection conn=DriverManager.getConnection(jdbc_name);
                Statement st = conn.createStatement();
                ResultSet rs = st.executeQuery("select * from country");

                     System.out.println("HI");

               } catch (Exception e){
                     System.out.println(e.getMessage());
                     rs.close();
                     conn.close();
               }

SECOND WAY:

public void connecter() {
    System.out.println("MySQL Connect Example.");
    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/";
    String dbName = "jdbctutorial";
    String driver = "com.mysql.jdbc.Driver"; // second driver;
    String userName = "root";
    String password = "root";
    try {
      Class.forName(driver).newInstance();
      conn = DriverManager.getConnection(url
+dbName,userName,password);
      System.out.println("Connected to the database");
      conn.close();
      System.out.println("Disconnected from database");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to