Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
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 08-03-2007, 02:40 PM
Member
 
Join Date: Jun 2007
Posts: 6
javagal is on a distinguished road
connecting to mysql database
Hi,
I have written a simple jsp file in netbeans 5.0, which connects to mysql database.
I am using a Connector/J driver,

This is my code :

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.sql.Connection,
java.sql.DriverManager,
java.sql.SQLException"
%>
<%

Connection con = null;
out.println("coming here...");
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance ();
con = DriverManager.getConnection("jdbc:mysql:///ebusiness","root", "nbuser");
if(!con.isClosed())
{
out.println("Successfully connected to " +"MySQL server using TCP/IP...");
}
}catch(SQLException e) {
e.printStackTrace();
}
catch(Exception ex) {
out.println("Exception: " + ex.getMessage());
} finally
{
try
{
if(con != null)
con.close();
} catch(SQLException e) {
out.println("Exception: " + e.getMessage());
}
}


%>


when i run this program,
I m getting exception as : Exception: com.mysql.jdbc.Driver

while I have installed mysql driver on my machine.., but do i need to keep my Driver class file at any perticular location/

Please help me.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-03-2007, 03:15 PM
Senior Member
 
Join Date: Dec 2006
Posts: 748
levent is on a distinguished road
Quote:
I m getting exception as : Exception: com.mysql.jdbc.Driver
I guess this is not the full exception. There should be some notes/description related to this (e.g. could not find xxxx).
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 08-04-2007, 02:36 PM
Member
 
Join Date: Jun 2007
Posts: 6
javagal is on a distinguished road
hay....thnx....
its solved..
I put Drivers jar file into java working directories lib file .

Its working file...
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
connecting to a database mxb7642 Database 2 08-20-2008 07:59 PM
Connecting to a database peiceonly New To Java 2 04-06-2008 04:28 PM
problem in connecting to mysql database nancyv Java Servlet 6 04-02-2008 01:33 PM
Specifying the character set while connecting to the database Java Tip Java Tips 0 02-13-2008 01:26 PM
Error while connecting to a database Fukushuusha Database 2 12-16-2007 11:40 AM


All times are GMT +3. The time now is 07:50 AM.


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