Ejemplo n.º 1
0
 @Ignore
 @Test
 public void shouldConnectToEmptyDatabase() throws SQLException {
   try (MySQLConnection conn = MySQLConnection.forTestDatabase("emptydb"); ) {
     conn.connect();
   }
 }
Ejemplo n.º 2
0
 @Ignore
 @Test
 public void shouldConnectToDefaulDatabase() throws SQLException {
   try (MySQLConnection conn = MySQLConnection.forTestDatabase("mysql"); ) {
     conn.connect();
   }
 }
Ejemplo n.º 3
0
 @Test
 public void shouldDoStuffWithDatabase() throws SQLException {
   try (MySQLConnection conn = MySQLConnection.forTestDatabase("readbinlog_test"); ) {
     conn.connect();
     // Set up the table as one transaction and wait to see the events ...
     conn.execute(
         "DROP TABLE IF EXISTS person",
         "CREATE TABLE person ("
             + "  name VARCHAR(255) primary key,"
             + "  birthdate DATE NULL,"
             + "  age INTEGER NULL DEFAULT 10,"
             + "  salary DECIMAL(5,2),"
             + "  bitStr BIT(18)"
             + ")");
     conn.execute("SELECT * FROM person");
     try (ResultSet rs =
         conn.connection().getMetaData().getColumns("readbinlog_test", null, null, null)) {
       // if ( Testing.Print.isEnabled() ) conn.print(rs);
     }
   }
 }