This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

simple Sql connectivity problem

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello everyone
i am trying to connect java file with MySQL database.
although i set the classpath ,copy the exact code from the internet; but still i meet with some problem shown in the snapshot (attached);
i don't have any idea why this happen;
please help

ScreenShot002.jpg
[Thumbnail for ScreenShot002.jpg]
ScreenShot003.jpg
[Thumbnail for ScreenShot003.jpg]
ScreenShot004.jpg
[Thumbnail for ScreenShot004.jpg]
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can you please post output of below command? I assume you are working on Windows OS.

echo %CLASSPATH%

 
sparsh khandelwal
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for looking my problem
yes i m working on window 7.
the output of the echo %CLASSPATH% is same as the location of jar file of mysqlconnector in my computer
ScreenShot005.jpg
[Thumbnail for ScreenShot005.jpg]
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

It seems the issue is classpath only. You can try below:

java -cp .;<path_of_your_connector_jar> <name_of_your_class>

I've not worked much on Windows, so please check what is classpath delimeter. I guess its semicolon. So, in above command, classpath contains current directory and connector jar.

Also, please copy paste the output instead of attaching screenshots.
reply
    Bookmark Topic Watch Topic
  • New Topic