• 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

JDBC Drivers?? Help Please

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am having a hard time understanding something that might be simple..... PLEASE HELP !
I am trying to write a program ,,,,,,,,

import java.sql.*;
import java.io.*;
public class JavaSql1 {
public static void main(String str[]){
Statement stat;
ResultSet rs;
Connection conn;
try{
Class.forName("*** What do i write here *** "); //what Driver name to specify ??
conn = DriverManager.getConnection("*** What do i write here *** "); // HOw do i specify database name ??
stat = conn.createStatement();
rs = stat.executeQuery("Select * From My_Reminders");
ResultSetMetaData rsmd = rs.getMetaData();
System.out.println("NO. of Clouumns is: " + rsmd.getColumnCount());
for (int i = 0; i <= (rsmd.getColumnCount()); i++)
{
String name = rsmd.getColumnName(i);
System.out.println( name +"/t"+ rsmd.getColumnType(i));
}
stat.close();
conn.close();
}
catch(Exception e){
System.out.println("error");
}
}
}

I am working on Windows 2000
I Am using jdk1.3.1_01
i set the path to "h:\jdk1.3.1_01\bin"
Wish to assess my Database which is in Oracle 9i
Database name "HOME"
and my Program "JavaSql1.java is saved in "h:\My Java"
Where do i see the list of various drivers i have on my system...how do i set it ??
HOw do i know which one to use ?
Your help is greatly appreciated
Thanks
[ March 13, 2002: Message edited by: Richa Jeetah ]
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although the JDBC API insulates you from many database-specific things, a few remain. You'll have to consult the documentation for your database/JDBC driver, in your case, Oracle 9i.
First, ensure that the appropriate driver, according to Oracle's documentation for your version, is on your classpath. Oracle usually includes the driver(s) with the database, and the drivers are available via download as well at the Oracle Technology Network.
Second, consult the documentation to see what the appropriate driver classname is and what the url syntax is.
(Most documentation that I've used is very clear on the above two issues; where it tends to be lacking is in troubleshooting information, what types of errors cause what exceptions).
Finally, to aid in troubleshooting your program, instead of printing "error" when you catch the exception, print the message of the exception via its getMessage() method or the exception as a string via its toString() method.
Good luck,
Craig
 
Richa Jeetah
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Craig Demyanovich:
Although the JDBC API insulates you from many database-specific things, a few remain. You'll have to consult the documentation for your database/JDBC driver, in your case, Oracle 9i.
First, ensure that the appropriate driver, according to Oracle's documentation for your version, is on your classpath. Oracle usually includes the driver(s) with the database, and the drivers are available via download as well at the Oracle Technology Network.



How do i know if i have the paaropriate driver or not ?
what is the meaning of this error:
Exception in thread "main" java.lang.NoClassDefFoundError: JavaSql5
[ March 13, 2002: Message edited by: Richa Jeetah ]
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These should be all the Oracle resources you need to get started, get familiar with jdbc, trouble shoot your problems, and eventually become advanced!
1. download your oracle drivers at http://technet.oracle.com/software/tech/java/sqlj_jdbc/content.html and follow the download procedures (Click the link "Oracle9i 9.0.1 JDBC Drivers for use with JDK 1.2.x/JDK 1.3.x for NT" --> then check all the checkboxes --> then click on "JDBC-Thin, 100% Java ( 1,081 kb)")
2. enable the client to connect(set environment):
Setting Up Your Environment
---------------------------
On Win95/Win98/NT:
- Add [ORACLE_HOME]\jdbc\lib\classes12.zip and
[ORACLE_HOME]\jdbc\lib\nls_charset12.zip OR add to your CLASSPATH C:\temp\classes12.zip if you downloaded classes12.zip to the c:/temp directory.
**note: classes12.zip is the name of the file that you downloaded in step 1 (do not unzip!)
RESOURCES
3. All the Oracle specific code that you could ever need -->look for the "JDBC Samples" links
4. code snippets that explain various tasks(i.e. connection procedures...:

if you come accross a problem, check this list before you post

if you come accross an Oracle SQLException, then you can investigate the ORA-XXXXX error messages and solutions

good luck,
Jamie
[ March 13, 2002: Message edited by: Jamie Robertson ]
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Richa,
In Windows control panel, select the ODBC Data Sources. Then select the drivers tab to see the drivers that are registered on your machine. If no Oracle driver is listed then download one. It will show up here after you download it.
hob
 
Then YOU must do the pig's work! Read this tiny ad. READ IT!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic