please help!! I have Oracle8i personal and jdk1.3 and Tomcat installed on my computer(win98).What settings I need for database connectivity?From where I get Localhost,port and SID? Thanx, neelu
prabhat kumar
Ranch Hand
Joined: Apr 11, 2001
Posts: 114
posted
0
if u have used the default installation then usually u can get connection by these values Class.forName("oracle.jdbc.driver.OracleDriver"); Connection dbCon = DriverManager.getConnection("jdbc racle:thin:@localhost:1521:local", "tiger","tiger"); Statement stmt = dbCon.createStatement(); ResultSet rs = stmt.executeQuery("select * from emp");
hope it will help .. if it is still not clear .. just ask ...
Neelu Bothra
Greenhorn
Joined: Oct 21, 2000
Posts: 23
posted
0
hello prabhat! I tried your suggestion but I'm getting Error 500(internal server error).so how do I know Localhost,port and SID? please help. neelu
prabhat kumar
Ranch Hand
Joined: Apr 11, 2001
Posts: 114
posted
0
please post ur code .. also see that u have oracle jdbc drivers in ur classpath so that jvm can locate it ..
Neelu Bothra
Greenhorn
Joined: Oct 21, 2000
Posts: 23
posted
0
hello prabhat My autoexec.bat file is C:\ESSAUDIO.COM SET path="C:\Program Files\Oracle\jre\1.1.7\bin";"c:\jdk1.3\bin"; SET path="C:\Program Files\Oracle\jre\1.1.7\bin";"%path%"; SET Path=c:\Oracle\Ora81\bin;"%Path%" set TOMCAT_HOME=c:\tomcat set JAVA_HOME=c:\jdk1.3 Set PATH=%PATH%;c:\jdk1.3\bin when I add classpath to this as set classpath=.;"c:\oracle\ora81\jdbc\lib\classes12.zip" then tomcat stops running. my code is package nil; import java.sql.* ; import java.io.Serializable; public class Lesson13 implements java.io.Serializable { public Lesson13() {} public String runSql () { String browserOutput = ""; Connection sqlca = null; Statement sqlStatement = null; ResultSet myResultSet = null;
/* Connect to database, run SQL and produce output */ try { Class.forName("oracle.jdbc.driver.OracleDriver"); String theDatabase ="jdbc racle:thin:@anil:1521:NEELU"; sqlca = DriverManager.getConnection(theDatabase, "scott","tiger"); sqlStatement = sqlca.createStatement(); myResultSet = sqlStatement.executeQuery ("select * from emp ");
I got port and localhost from start--->programs-->orahome-->network admi-->net8ass-->local thanx, neelu
prabhat kumar
Ranch Hand
Joined: Apr 11, 2001
Posts: 114
posted
0
Originally posted by Neelu Bothra: My autoexec.bat file is C:\ESSAUDIO.COM SET path="C:\Program Files\Oracle\jre\1.1.7\bin";"c:\jdk1.3\bin"; SET path="C:\Program Files\Oracle\jre\1.1.7\bin";"%path%"; SET Path=c:\Oracle\Ora81\bin;"%Path%" set TOMCAT_HOME=c:\tomcat set JAVA_HOME=c:\jdk1.3 Set PATH=%PATH%;c:\jdk1.3\bin when I add classpath to this as set classpath=.;"c:\oracle\ora81\jdbc\lib\classes12.zip" then tomcat stops running.
u shud unzip the oracle.zip in jdk1.3\lib directory .. and then directory strucure wud be jdk1.3 | ----- lib | ------- Oracle | --------- core--gss --and other directories ..as the zip file will automaticly recreate .. as the zip itslef consist of Oracle as top level directory
ur autoececbat file shud look like C:\ESSAUDIO.COM SET path=%PATH%;.;c:\jdk1.3\bin;c:\jdk1.3\lib;c:\jsdk2.0\bin;c:\jsdk2.0\lib;C:\Program Files\JavaSoft\JRE\1.3\bin;C:\Oracle\Ora81\bin;C:\Program Files\Oracle\jre\1.1.7\bin; set CLASSPATH=.;C:\jdk1.3\lib\;C:\jdk1.3\lib\tools.jar;C:\JSDK2.0\lib\jsdk.jar;C:\JSDK2.0\lib; set TOMCAT_HOME=c:\tomcat set JAVA_HOME=c:\jdk1.3
since in ur classpath the oracle's old java classes r first there ..so the jvm never looks to JDK1.3\classes directory but to the Oracle directory first and it will give the error .. so u modify it like this and no double quotes r needed and CLASSPATH as below ...jsdk if u use servlet development kit ..
Neelu Bothra
Greenhorn
Joined: Oct 21, 2000
Posts: 23
posted
0
Hi! I'm still getting same error.
Neelu Bothra
Greenhorn
Joined: Oct 21, 2000
Posts: 23
posted
0
Thanks Prabhat, It's working with some changes in autoexec.bat as suggested by you. thanx again neelu