LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-03-2008, 09:39 AM   #1
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Rep: Reputation: 30
jdbc on ubuntu no class found


Hello all,

Could some one please explain why my program cant find the jdbc driver for my mysql database I have configured it according to the ubuntu website, it looks like other people have had a similar problem until the defined their drivers in their classpath. But I still get the same error no class defined errors:


install jdbc:
Code:
sudo aptitude install libmysql-java
export the classpath:
Code:
export CLASSPATH=$CLASSPATH:/home/adrian/Desktop/mysql-connector-java-5.1.5.    tar.gz:/usr/share/java/mysql-connector-java.jar:/usr/share/java/mysql.jar:/u    sr/share/java/jtds-1.2.2.jar

Application code:

Code:
dbDriver    =   "com.mysql.jdbc.Driver";
dbUrl       =   "jdbc:mysql://localhost/helpdesk";

Error message:

Code:
Error with SQL: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/helpdesk.
Could someone please help with this, thanks trscookie.
 
Old 02-06-2008, 07:24 PM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Why does your classpath look so weirdly chopped up?

Anyway, check your /usr/share/java, I don't think that there is a "mysql-connector-java.jar", I am missing the version numbers..

Also, if you put the path in /etc/profile, make sure that the file gets sourced.
 
Old 02-06-2008, 07:31 PM   #3
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 463

Original Poster
Rep: Reputation: 30
I think that it must have been something to do with the way that I pasted the line in, It doesnt look like that on my profile, I should have mentioned that mysql-connector.jar is a symlink to the jdbc.jar.

I've just found out what the problem is, even though the jdbc jar was in my classpath I did not have the jdbc driver linked in my project, school boy error! Thanks anyway, trscookie.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ templated Node class: pointers to different instantated class types jhwilliams Programming 3 08-20-2007 06:20 PM
java jdbc and ubuntu problem trscookie Programming 2 01-21-2007 11:35 AM
Postgresql, JDBC on Ubuntu Kateto Linux - Server 0 09-06-2006 01:22 PM
Does derivated class inherit base class destructor (constructor)? kornerr Programming 2 08-23-2006 08:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration