Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-15-2007, 03:06 PM
Member
 
Join Date: May 2007
Posts: 39
Nick15 is on a distinguished road
Mysql problem
Hi everybody I am trying to do a basic library system.
the problem is:
I downloaded MySQL driver (connector/j) I copied .jar in CLASSPATH/jre/lib/ext
but it didn't work, I tried to copy the .jar in the directory of my application where I have my .java (or .class in execution time)
but when I execute the application the following error appear:

java.lang.ClassNotFoundException: Resource not found:
com/mysql/jdbc/Driver.class

this is the code:
Code:
try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); aqui parece estar el error. String url = "jdbc:mysql://mysql.webcindario.com"; String login = "user"; String password = "password"; Connection conn = DriverManager.getConnection(url,login,password); if (conn != null) { JOptionPane.showMessageDialog(null, "conexion", "alert", JOptionPane.ERROR_MESSAGE); conn.close(); } } catch(SQLException sql) { sql.printStackTrace(); } catch(ClassNotFoundException cnfe) { cnfe.printStackTrace(); } catch (Exception ex) { ex.printStackTrace(); }
Please help me
Nick

Last edited by Nick15 : 06-01-2007 at 01:41 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-15-2007, 04:45 PM
Member
 
Join Date: Apr 2007
Location: Indiana
Posts: 84
pegitha is on a distinguished road
Send a message via Skype™ to pegitha
Is this a web app ?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-15-2007, 06:07 PM
Member
 
Join Date: May 2007
Posts: 42
Freddie is on a distinguished road
I give you 2 solutions:

1 the official one: Add the driver to classpath, never mind where the applet and the connector are
it would be something like this:
JAVA_HOME=/usr/local/jdk1.x
export JAVA_HOME
CLASSPATH=${JAVA_HOME}/lib/tools.jar
CLASSPATH=${CLASSPATH}:${JAVA_HOME}/jre/lib/ext/theconnector.jar
export CLASSPATH
(is an example)

2. not official one (but it works!): unzip connector.jar, do it with winrar (WinRAR archiver, a powerful tool to process RAR and ZIP files) when you unzip there are folders in a hierarchy order,
start with 'com' folder,explorer it: com->mysql->jdbc, copy 'com' folder (with its content) into directory where there are the applet whose connect to mysql
and that is!

good luck!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in connecting to mysql database nancyv Java Servlet 6 04-02-2008 12:33 PM
Problem with jTable that is binded with a table in MySQL Database rajkenneth NetBeans 0 03-29-2008 04:36 PM
mysql driver problem mokingsu Database 4 01-17-2008 06:27 PM
Problem inserting values to MySQL tables from the Data Source Explorer tip Eclipse 0 12-24-2007 10:47 AM
JSP and MySQL Ed JavaServer Pages (JSP) and JSTL 2 07-04-2007 06:08 AM


All times are GMT +3. The time now is 02:04 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org