//package bug20888; import com.mysql.jdbc.util.BaseBugReport; import java.sql.Connection; import java.util.Properties; import java.sql.*; import java.util.logging.*; public class bug20888 extends BaseBugReport { private static final Properties properties = new Properties(); { properties.put("user","root"); } public String getUrl() { return "jdbc:mysql://127.0.0.1:3306/test"; } public bug20888() { } /** * Override this method with code that demonstrates the bug. * * @throws Exception if an error occurs during your test run. */ public void runTest() throws Exception { Logger.getLogger(this.getClass().toString()).entering("runTest",""); Connection conn = getConnection(getUrl(), properties); Statement stmnt = conn.createStatement(); stmnt.execute("INSERT INTO Studies VALUES ('D\'artanian');"); conn.close(); Logger.getLogger(this.getClass().toString()).exiting("runTest",""); } /** * Override this method with code that sets up the testcase for * demonstrating your bug (creating tables, populating data, etc). * * @throws Exception if an error occurs during the 'setUp' phase. */ public void setUp() throws Exception { Logger.getLogger(this.getClass().toString()).entering("setUp",""); Connection conn = getConnection(getUrl(), properties); Statement stmnt = conn.createStatement(); stmnt.execute("CREATE TABLE `Studies`(`NCTId` varchar(31) NOT NULL default '');"); conn.close(); } /** * Override this method with code that cleans up anything created in the * setUp() method. * * @throws Exception if an error occurs during the 'tearDown' phase. */ public void tearDown() throws Exception { Logger.getLogger(this.getClass().toString()).entering("tearDown",""); Connection conn = getConnection(getUrl(), properties); Statement stmnt = conn.createStatement(); stmnt.execute("drop table `Studies`"); conn.close(); } public static void main(String[] args) { bug20888 bug20888 = new bug20888(); try { bug20888.setUp(); try { bug20888.runTest(); } catch (Exception ex) { ex.printStackTrace(); } bug20888.tearDown(); } catch (Exception ex) { ex.printStackTrace(); } } }