This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes Failed to load JDBC/ODBC driver. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC
Bookmark "Failed to load JDBC/ODBC driver." Watch "Failed to load JDBC/ODBC driver." New topic

Failed to load JDBC/ODBC driver.

Mohd Zaki Mohd Salikon

Joined: Dec 16, 2004
Posts: 27
Hi everybody. I'm studying a short java program. This program is using an URL connection. I believe, this code is connect to database using TCP/IP. I was drag the database to my Computer for accessing the data with a standalone system. Can I change this URL code to standalone system?How?

import java.sql.*; //import all the JDBC classes
public class Data { //1

String subjek[] = new String[100] ;
int bil=0;

public Data() {//2
String URL = "jdbc:ids://'IDSExamples'";
String username = "";
String password = "";

try { //3
} //3
catch (Exception e) { //4
System.out.println("Failed to load JDBC/ODBC driver."); return; } //4
Statement stmt = null;
Connection con=null;
try { //5
con = DriverManager.getConnection (URL);
stmt = con.createStatement();
} //5
catch (Exception e) { //6
System.err.println("problems connecting Data to "+URL);
} //6

try { //7 execute SQL commands to create table, insert data

String query = "SELECT * FROM Kursus Where Kod Like 'T%' ";
ResultSet rs = stmt.executeQuery(query);

while ( {//8
//System.out.println("Kod Kursus: " +rs.getString("Kod")+ " Nama: " +rs.getString("Nama") );
subjek[bil] = new String(rs.getString("Kod"));

} //7
catch (Exception e) { //9
System.err.println("problems with SQL sent Data to "+URL+": "+e.getMessage()); }//9


public int getbil() {
return bil;

public String[] getsubjek() {
return subjek;

public static void main(String[] args) {
int bil=0;
int i=0;
String subjek[];

Data cuba = new Data();
bil = cuba.getbil();
subjek = cuba.getsubjek();
System.out.println("Bilangan semua tempat ialah : " + bil);
while (i<bil) {
System.out.println("Kod subjek: " + subjek[i]);
Yu Tao

Joined: Dec 12, 2004
Posts: 28
this is error

what is you database??? SQL???Oracle???MysQL???
Mohd Zaki Mohd Salikon

Joined: Dec 16, 2004
Posts: 27
Microsoft Access (Data.mdb). I was setup using JDBC.
Mohd Zaki Mohd Salikon

Joined: Dec 16, 2004
Posts: 27
Thanks. I got it. I'm using the file name of database.
GeeCON Prague 2014
subject: Failed to load JDBC/ODBC driver.