Author
jdbc connection
preethi Ayyappan
Ranch Hand
Joined: Oct 04, 2007
Posts: 518
posted Jan 05, 2008 02:39:00
0
Hi, I am having a simple java program which connects with the mysql database in the path c:\>j2sdk1.4.2_16/bin.when i compile this it compiles well. I am having my sql.jar file (ie)mysql-connector-java-3.0.17-ga folder which consist of meta-inf and mysql-connector-java-3.0.17-ga-bin.jar in the path c:\>j2sdk1.4.2_16/lib.when i compiled and run my program like this
c:\>j2sdk1.4.2_16/bin/javac Connect.java c:\>java -classpath .:j2sdk1.4.2_16/lib/mysql-connector-java-3.0.17-ga/lib/mysql-connector-java-3.0.17-ga-bin.jar Connect
It displays the error:
my program is: . Thanks.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35253
posted Jan 05, 2008 03:04:00
0
public class Connect1
There's your problem - the source file does not contain a class called Connect .
Android apps – ImageJ plugins – Java web charts
preethi Ayyappan
Ranch Hand
Joined: Oct 04, 2007
Posts: 518
posted Jan 05, 2008 03:10:00
0
sorry by mistake i have posted like that.I had given the name correctly.but i am getting error like the same
P. Jain
Greenhorn
Joined: Jan 03, 2008
Posts: 15
The name of the class you are trying to run using the java command and the is different from the name of your class. The name of the class should be the same.
SCJP 5.0<br />SCWCD 5.0<br />Preparing for SCDJWS
preethi Ayyappan
Ranch Hand
Joined: Oct 04, 2007
Posts: 518
posted Jan 05, 2008 03:28:00
0
thats what i mentioned in the last post.by mistake i have posted wrongly.I have given the class name Connect in the program. Thanks.
preethi Ayyappan
Ranch Hand
Joined: Oct 04, 2007
Posts: 518
posted Jan 05, 2008 04:05:00
0
please anyone guide me to do this
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35253
posted Jan 05, 2008 04:33:00
0
You're using a colon to separate the classpath entries. But on Windows, a semicolon is the correct separator.
preethi Ayyappan
Ranch Hand
Joined: Oct 04, 2007
Posts: 518
posted Jan 05, 2008 05:02:00
0
c:\>java -classpath .;j2sdk1.4.2_16/lib/mysql-connector-java-3.0.17-ga/lib/mysql-connector-java-3.0.17-ga-bin.jar Connect
you mention java-classpath.;this semicolon...if so i've already given.....
preethi Ayyappan
Ranch Hand
Joined: Oct 04, 2007
Posts: 518
posted Jan 05, 2008 05:45:00
0
Thank you all.I got the jdbc connection.I set the classpath in environment variables .
subject: jdbc connection