This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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.
I agree. Here's the link:
subject: Failed to load JDBC/ODBC driver.
It's not a secret anymore!