English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

mysql server is already installed in linux and driver also.i want to connect my java(core) application with mysql server in linux.but i have ClassNotFoundExcepition in my programe,why plz tell me with solution.my coding is:

import java.sql.* ;

public class exam
{
public static void main( String[] args )
{
try
{
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
try
{
Connection con = DriverManager.getConnection( "jdbc:mysql://localhost/scholar", "root", null );

try
{
Statement statement = con.createStatement();

ResultSet rs = statement.executeQuery("SELECT NAME FROM STUDENT");

while ( rs.next() )
{
System.out.println( rs.getString( "NAME" ) );
}

rs.close();
statement.close();
}
catch (

2007-02-16 22:56:21 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

It looks like you did not install the JDBC connector for mysql. You can get that here:
http://dev.mysql.com/downloads/connector/j/3.0.html

2007-02-17 01:19:23 · answer #1 · answered by Vegan 7 · 0 0

I hope this link will help you.
http://dev.mysql.com/doc/refman/5.0/en/can-not-connect-to-server.html

2007-02-17 00:35:43 · answer #2 · answered by IT-guru 5 · 0 0

fedest.com, questions and answers