This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I have JDK 1.3 and the Personal Oracle database in my machine in Windows 98. I have included classes111.zip in the CLASSPATH. I don't know how to start the connection. I checked out some tutorials and documentation, I am not yet clear. My questions are: >> Do I need JDK 1.2 to use with Personal Oracle? >> How do I create a database (CREATE DATABASE)? >> How do I create a table? >> Second and Third questions are independent of JDBC and Java. In the Java Program, this is what I understand so far 1. I should use import java.sql.*; 2. Connection c=DriverManager.getConnection(???) How do I go about it? Regards, Shree [This message has been edited by shree vijay (edited January 23, 2001).]
>> Do I need JDK 1.2 to use with Personal Oracle? No, but it would be better if you used the same versions of java and jdbc. For JDK1.1, uses classes111.zip. If you are using Java 2 (1.2 or 1.3) use classes12.zip available from Oracle. >> How do I create a database (CREATE DATABASE)? Use a statement. Statement s = conn.createStatement(); s.executeUpdate("CREATE DATABASE....."); Although creating a database would be much better done directly in oracle >> How do I create a table? Statement s = conn.createStatement(); s.executeUpdate("CREATE TABLE....."); >> Second and Third questions are independent of JDBC and Java. >> In the Java Program, this is what I understand so far >> 1. I should use import java.sql.*; >> 2. Connection c=DriverManager.getConnection(???) >> How do I go about it? Wrox Press just published a book on Oracle 8i Application Programming. Download the code for chapters 5 - 16 and then look at the examples for chapter 12. These classes in particular may help: TestJdbc.java (check your installation) ForNameLoader.java (how load driver and get connection) ConnectionTest.java (various connection methods) SimpleStatement.java (creates tables using jdbc)
Joined: Sep 18, 2000
Hi, Thanks for the help. I downloaded your examples. But now I am getting a problem when I try to run your programs. javac compiles fine. But when I run using java -classpath . <filename> it says, "Registry key 'Software\JavaSoft\Java Runtime Environment\Current Version' has value 1.1 , but 1.3 is required. Error: could not find java.dll Error: could not find Java 2 Runtime Environment I could compile and run programs java programs previously in jdk1.3. But now I am not able to run anything.
I searched for java.dll and found it in c:\jdk1.3\jre\bin. Was something changed because I downloaded personal Oracle 8i -- it didn't seem to have 1.3 anywhere. Thanks for the help, Shree [This message has been edited by shree vijay (edited January 24, 2001).]
Hi Shree, It seems there is not problem with youe JDBC driver but the problem is with you windows registry. Best way is to uninstall and then reinstall JDK1.3 but if it does not help then you need to fiddle with you windows registry. run regedit. You will get interface similar to windows explorer. there you can edit the registry. I think by just correcting HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER will help. Goto HKEY_CURRENT_USER\software\javasoft\java plugin\java runtime version. make sure value 1.3 s specified for it if not so correct it. Now goto HKEY_LOCAL_MACHINE\software\javasoft\java runtime environment. (Stop there do not goto next level. Next level you will find multiple versions like 1.1, 1.2,1.3etc.) And check for the kay value current value. Make sure it is 1.3. If it is not then first check whether in next level 1.3 is there. And if it is there then change the value of HKEY_LOCAL_MACHINE\software\javasoft\java runtime environment to 1.3 in the next level i.e. HKEY_LOCAL_MACHINE\software\javasoft\java runtime environment\1.3 makesure corect paths are specified for Runtime lib. Iknow it is pretty confusing but you need to be brave and do it your self. I have done it once without any problem. So try it. Good Luck
Thanks a lot Anand for that detailed explanation, it worked!! ------------------ Regards, Shree
Joined: Sep 18, 2000
Hi, This is my program portion which gives the error
conn = DriverManager.getConnection( "jdbc : oracle : oci8:@shree", "scott", "tiger"); shree is my sid in the oracle database. I am working in c:\java\jdbc\pgms All the unzipped personal oracle is in c:\java\jdbc\pgms\oracle The full oracle stuff is at c:\oracle.... I am able to compile my program, but when running it, the error is : Exception in thread main java.lang.UnsatisfiedLinkError no ocijdbc8 in java.library.path I have included classes12.zip in the classpath and
c:\oracle\ora81\jdbc\lib in the path
I am not able to run any demos that come with personal oracle since they give the same problem. Is there anything wrong with my directory structure? What should I do ?
Thanks for the help, Shree. [This message has been edited by shree vijay (edited January 24, 2001).] [This message has been edited by shree vijay (edited January 24, 2001).]