aspose file tools*
The moose likes JDBC and the fly likes do i need odbc to run java applications - reg connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

do i need odbc to run java applications - reg connection

riyaz udeen
Ranch Hand

Joined: Sep 11, 2005
Posts: 66
iam new to jdbc . i hav installed mysql 4.1.
since iam working on java & jdbc, i got the zip of connector/j 3.1.8.
i unzipped it in a folder-a & added the folder to class path env variables.moreover i also added the myconnector-java-3.1.8-bin jar file avl inside the above a - folder.moreover i did not found
the com & org sub directorie in the unziped folder-a.

when i runned this programm after sucessgully starting the mysql server
i got this messg:

SQLException: No suitable driver
SQLState: 08001
VendorError: 0

the programm is :

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.*;

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

Statement st ;
String create;
create = " CREATE TABLE tea ( tea_name VARCHAR (20), id NUMBER (3))";



try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (Exception ex) { }

try {
Connection c = DriverManager.getConnection("jdbc:mysql://127.0.0.1/testuser=riyaz&password=zarina");
st = c.createStatement();
st.executeUpdate (create);
st.close();
c.close();
}
catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
}
}

kindly provide me the rectification for this problm.moreover i dont have mysql driver in my system.thank u .

regards
riyaz
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61187
    
  66

Please do not post the same question more than once.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: do i need odbc to run java applications - reg connection