Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 06-04-2006, 10:26 AM   #1
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 462

Rep: Reputation: 30
Unhappy missing jdbc isnt actually missing.

hello all ive just emerge'd jdbc-mysql and i cant get a single jdbc application to work, im trying to do an assignment for university, and part of it is to write a jdbc database using mysql i tried this code from sun.

package JDBC.Connect;

   import java.sql.*;

   public class Connect
       public static void main (String[] args)
           Connection conn = null;

               String userName = "testuser";
               String password = "testpass";
               String url = "jdbc:mysql://localhost/test";
               Class.forName ("com.mysql.jdbc.Driver").newInstance ();
               conn = DriverManager.getConnection (url, userName, password);
               System.out.println ("Database connection established");
           catch (Exception e)
               System.err.println ("Cannot connect to database server");
               if (conn != null)
                       conn.close ();
                       System.out.println ("Database connection terminated");
                   catch (Exception e) { /* ignore close errors */ }

but this is the error i get:

Cannot connect to database server
if i add e.getMessage to the end of the last output it says:
so basicly i think that its looking for the jdbc class file, however 1. i dont know where gentoo puts it, and 2. i wouldnt know what to do with it when i have found it!!!.

please please help this is worth 65% of my whole course and i cant even get it to connect to the database!!! cheers trscookie


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
Problem running UT Demo, Xlib missing on 0.0.. gldrv missing etc. RHLinuxGUY Linux - Games 3 05-21-2006 11:02 PM
java +missing return statement? no it isnt trscookie Programming 9 04-21-2006 08:57 PM
need some X help, seems to be missing sporkydonkey Slackware 10 08-22-2004 01:43 PM
WTF? isnt linux come lindows isnt? Cycopath81090 Linux - Newbie 11 08-22-2003 08:19 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:24 PM.

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