hi, everyone
i am pretty new to JDBC and i try to creat a table called COFFEES in the COFFEEBREAKTRY databas which exits in my sql server. The following program seems ok to me however i got erro :Exception in thread "main" java.lang.NoClassdefFounderError:creatCoffee.
could anyone help me out? (many thanks).
import java.sql.*;
import java.util.Properties;
public class CreateCoffees {
public static void main(String args[]) {
String url = "jdbc:weblogic:mssqlserver4";
Connection con;
String createString;
createString = "create table COFFEES " +
"(COF_NAME varchar(32), " +
"SUP_ID int, " +
"PRICE float, " +
"SALES int, " +
"TOTAL int)";
Statement stmt;
Properties props = new Properties();
props.put("user", "caofengqiao");
props.put("password", "8801386");
props.put("server", "COFFEEBREAKTRY@CFQ-YQ1RKQ9LSD7:1433");
//database name=COFFEEBREAKTRY,Server=CFQ-YQ1RKQ9LSD7
try {
Class.forName("weblogic.jdbc.mssqlserver4.Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,props);
stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}