Testar com MySQL

1 resposta
Rafael_Nunes

http://www.guj.com.br/posts/list/25358.java
http://www.guj.com.br/posts/list/24611.java

1 Resposta

T

eu peguei da net o seguinte código:

public TableDisplay() 
   {   
      // The URL specifying the Books database to which 
      // this program connects using JDBC to connect to a
      // Microsoft ODBC database.
      String url = "jdbc:odbc:Books1";  
      String username = "anonymous";
      String password = "guest";

      // Load the driver to allow connection to the database
      try {
         Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );

         connection = DriverManager.getConnection( 
            url, username, password );
      } 
      catch ( ClassNotFoundException cnfex ) {
         System.err.println( 
            "Failed to load JDBC/ODBC driver." );
         cnfex.printStackTrace();
         System.exit( 1 );  // terminate program
      }
      catch ( SQLException sqlex ) {
         System.err.println( "Unable to connect" );
         sqlex.printStackTrace();
      }

      getTable();

      setSize( 450, 150 );
      show();
   }

como faço pra testá-lo com MySQL?

Criado 23 de junho de 2005
Ultima resposta 23 de jun. de 2005
Respostas 1
Participantes 2