File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes please, help ! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "please, help !" Watch "please, help !" New topic

please, help !

fengqiao cao
Ranch Hand

Joined: Oct 26, 2001
Posts: 71
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 {
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
try {
con = DriverManager.getConnection(url,props);
stmt = con.createStatement();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
fengqiao cao
Ranch Hand

Joined: Oct 26, 2001
Posts: 71
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....
sharad goswami
Ranch Hand

Joined: Jan 18, 2001
Posts: 51
Dear Friend ;
It has nothing to do with jdbc its java runtime error

Stop The World I Want To Get Off.
I agree. Here's the link:
subject: please, help !
It's not a secret anymore!