Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Failed to load JDBC/ODBC driver.

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
Thanks...


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://161.142.43.224:12/conn?dsn='IDSExamples'";
String username = "";
String password = "";

try { //3
Class.forName("ids.sql.IDSDriver").newInstance();
} //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 (rs.next()) {//8
//System.out.println("Kod Kursus: " +rs.getString("Kod")+ " Nama: " +rs.getString("Nama") );
subjek[bil] = new String(rs.getString("Kod"));
bil++;
}//8

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

}//2

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]);
i++;
}
}
}//1
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Class.forName("ids.sql.IDSDriver").newInstance();
this is error

what is you database??? SQL???Oracle???MysQL???
 
Mohd Zaki Mohd Salikon
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Microsoft Access (Data.mdb). I was setup using JDBC.
 
Mohd Zaki Mohd Salikon
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I got it. I'm using the file name of database.
 
Lasagna is spaghetti flvored cake. Just like this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic