LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 06-04-2006, 10:26 AM   #1
trscookie
Member
 
Registered: Apr 2004
Location: oxford
Distribution: gentoo
Posts: 438

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.

Code:
Code:
package JDBC.Connect;

   import java.sql.*;

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

           try
           {
               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");
           }
           finally
           {
               if (conn != null)
               {
                   try
                   {
                       conn.close ();
                       System.out.println ("Database connection terminated");
                   }
                   catch (Exception e) { /* ignore close errors */ }
               }
           }
       }
   }


but this is the error i get:

Code:
Code:
Cannot connect to database server
if i add e.getMessage to the end of the last output it says:
Code:
com.mysql.jdbc.Driver
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
 
  


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
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 free...how come lindows isnt? Cycopath81090 Linux - Newbie 11 08-22-2003 08:19 PM


All times are GMT -5. The time now is 10:37 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration