If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Another "No Suitable Drive"

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-15-04, 02:25
blue0351 blue0351 is offline
Registered User
 
Join Date: Jan 2004
Posts: 2
Another "No Suitable Drive"

Another SQLException: No Suitable Driver

I, like many others, have explored this for a week and am now asking for help. Im not positive what im doing wrong. i believe im following the advice given in other threads. Im trying to connect to MySQL on my computer. my code is:


import java.sql.*;

public class CreateCoffees {
public static void main(String args[]) {

String url = "jdbc:mysql//localhost/blue";

String user = "root";
String password = "boulder";

Connection con;
String createString;

createString = "create table COFFEES " +
"(COF_NAME varchar(32), " +
"SUP_ID int, " +
"PRICE float, " +
"SALES int, " +
"TOTAL int)";

Statement stmt;

try {

Class.forName("com.mysql.jdbc.Driver").newInstance ();
} catch (Exception E) {
System.err.println("Unable to load driver.");
E.printStackTrace();
}
try {
con = DriverManager.getConnection( url, user, password );

System.out.println( "DriverManager: getConnection" );
stmt = con.createStatement();
stmt.executeUpdate(createString);

stmt.close();
con.close();

} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
ex.printStackTrace();
}
}
}

my CLASSPATH is:

.;"F:\Program Files\Java\j2re1.4.2_03\lib";"F:\j2sdk1.4.2_03\lib ";"F:\j2sdk1.4.2_03\jre\lib";"F:\MySQL_Driver";"F: \MySQL_Driver\mysql-connector-java-3.0.10-stable-bin.jar";"F:\Program Files\Java\j2re1.4.2_03\lib\ext\mysql-connector-java-3.0.10-stable.zip";"F:\icesol";"F:\icesol\lib";"F:\icesol \mysql-connector-java-3.0.10-stable.zip";"F:\icesol\mysql-connector-java-3.0.10-stable-bin.jar";

ive tried with and without the ""'s. Im doing this to gain a better understanding of java and mysql, but obviously im stuck in the beginning. Any and all help is greatly appreciative.

--blue0351
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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