LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2012, 07:18 AM   #1
vinod 123
LQ Newbie
 
Registered: Feb 2012
Posts: 1

Rep: Reputation: Disabled
Smile Error to JDBC Conectivity


hello
i need help for the i am trying program through jsp for mysql database conectivity it not load driver it display an error like
JDBC Driver cannot be loaded and it display error Driver name as it is
com.mysql.jdbc.Driver
on in browser window
I try with another driver it give me same error with driver name in
forClass.Name("com.mysql.jdbc.Driver");

i try one program without using JSP & run it it not give me any error..
please Help me......
 
Old 02-06-2012, 02:04 PM   #2
rhklinux
Member
 
Registered: Jan 2010
Location: india/pune
Distribution: Arch Fedora20
Posts: 126

Rep: Reputation: 18
which server are you using tomcat or glassfish? try a simple program and paste the complete output.
Quote:
import java.sql.*;
import javax.sql.*;

public class jdbcdemo{

public static void main(String args[]){
String dbtime;
String dbUrl = "jdbc:mysql://your.database.domain/yourDBname";
String dbClass = "com.mysql.jdbc.Driver";
String query = "Select * FROM users";

try {

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection (dbUrl);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

while (rs.next()) {
dbtime = rs.getString(1);
System.out.println(dbtime);
} //end while

con.close();
} //end try

catch(ClassNotFoundException e) {
e.printStackTrace();
}

catch(SQLException e) {
e.printStackTrace();
}

} //end main

} //end class
 
  


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
JDBC and MySQL Under Linux, Error KittenKoder Ubuntu 1 08-21-2008 08:47 AM
postgresql jdbc connection error dsids Programming 3 12-29-2006 07:27 AM
VPN conectivity headache jdlcomputers Linux - Networking 5 01-01-2005 02:52 PM
Fax Modem Conectivity nrbhadane Linux - Hardware 4 12-17-2003 08:48 PM
LAN Conectivity saroj Linux - Networking 1 11-16-2001 07:27 PM


All times are GMT -5. The time now is 06:07 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration