Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

please, help !

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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());
}
}
}
 
fengqiao cao
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Finally, i found out that there is nothing wrong with the code.
However, it is becuause the CLASSPATH problem.
I came from windows me to windows 2000. There is huge different(ha...) when dealing with CLASSPATH(In windows 2000 , if u want to run java application you must set the CLASSPATH but now in windows me) ha.....
hope this help the newbies like me....
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friend ;
It has nothing to do with jdbc its java runtime error
 
reply
    Bookmark Topic Watch Topic
  • New Topic