Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
JDBC and Relational Databases
No Suitible Driver Error
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Here is my code:
import java.sql.*; public class CreateCoffees { public static void main(String[] args) { String url = "jdbc:mysql:\\an IP\test"; Connection con; String createString; createString = "create table COFFEES " + "(COF_NAME VARCHAR(32), " + "SUP_ID INTEGER, " + "PRICE FLOAT, " + "SALES INTEGER, " + "TOTAL INTEGER)"; Statement stmt; try { Class.forName("org.gjt.mm.mysql.Driver"); } catch(java.lang.ClassNotFoundException e) { System.err.print("ClassNotFoundException: "); System.err.println(e.getMessage()); } try { con = DriverManager.getConnection(url, null, null); stmt = con.createStatement(); stmt.executeUpdate(createString); stmt.close(); con.close(); } catch(SQLException ex) { System.err.println("SQLException: " + ex.getMessage()); } } }
It compiles and then when I run it I just get an SQLException: No Suitable Driver
Help anyone?
Bosun Bello
Ranch Hand
Posts: 1514
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I am guessing it just can't find the driver for mySQL. It's either your class path is not set correctly or you have not downloaded the drivers.
Bosun (SCJP, SCWCD).
So much trouble in the world -- Bob Marley
Gregg Bolinger
Ranch Hand
Posts: 15304
6
I like...
posted 22 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I had figured it out over the weekend. I did download the drivers and put them in the appropriate folders. However, my
JAVA
Editor was over-riding my CLASSPATH that I had set. So I had to set the CLASSPATH inside my editor.
All fixed.
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Class.forName() for drive using Oracle 8i
SQLException: [Microsoft][ODBC Driver Manager]
Error when not in Main()
Access to the Oracle database using Java Applets
ClassNotFoundException generated!
More...