In the following code I am trying to DROP table from a sql DB:
public class SQLServerInitTest extends TestCase {
static String[] DB_TABLE = {"POI"};
/*
* @getConnect
*/
public Connection getConnection(){[t][t]
// Make connection to a SQL Server 2000 database.
Connection con = null;
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+ HOST_NAME +":1433;DatabaseName="+ DB_NAME +";User="+ USER_NAME +";Password="+ PASSWORD +"");
}
catch (Exception e) {
fail("Get Connection getConnection threw an exception: " +(e.getMessage()));
}
return con;
}
/*
* @testDropTable
*/
public void testDropTable () throws SQLException{
try {
Connection con = getConnection();
Statement stmt = con.createStatement();
String dropTable = "DROP TABLE ";
String[] tables = DB_TABLE;
for (int i = 0; i < tables.length; i++){
int temp = stmt.executeUpdate(dropTable + tables);
}
}
catch (Exception e) {
fail("Drop Table testDropTable threw an exception: " +(e.getMessage()));
}
}
}
I am getting the following error within the testDropTable method:
Drop Table testDropTable threw an exception: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1:Unclosed quotation mark before the character string 'Ljava.lang.String;@1dd9c6d5'.
In this array I can add additional tables if I need but when I try and drop a this single table from the array I get the error above.
Any help or direction would be appreciated.
[ August 01, 2005: Message edited by: Melinda Savoy ]
[ August 01, 2005: Message edited by: Melinda Savoy ]
public class SQLServerInitTest extends TestCase {
static String[] DB_TABLE = {"POI"};
/*
* @getConnect
*/
public Connection getConnection(){[t][t]
// Make connection to a SQL Server 2000 database.
Connection con = null;
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+ HOST_NAME +":1433;DatabaseName="+ DB_NAME +";User="+ USER_NAME +";Password="+ PASSWORD +"");
}
catch (Exception e) {
fail("Get Connection getConnection threw an exception: " +(e.getMessage()));
}
return con;
}
/*
* @testDropTable
*/
public void testDropTable () throws SQLException{
try {
Connection con = getConnection();
Statement stmt = con.createStatement();
String dropTable = "DROP TABLE ";
String[] tables = DB_TABLE;
for (int i = 0; i < tables.length; i++){
int temp = stmt.executeUpdate(dropTable + tables);
}
}
catch (Exception e) {
fail("Drop Table testDropTable threw an exception: " +(e.getMessage()));
}
}
}
I am getting the following error within the testDropTable method:
Drop Table testDropTable threw an exception: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Line 1:Unclosed quotation mark before the character string 'Ljava.lang.String;@1dd9c6d5'.
In this array I can add additional tables if I need but when I try and drop a this single table from the array I get the error above.
Any help or direction would be appreciated.
[ August 01, 2005: Message edited by: Melinda Savoy ]
[ August 01, 2005: Message edited by: Melinda Savoy ]