Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Kiran kk

Greenhorn
+ Follow
since Jun 17, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kiran kk

i'm writing a jsp file that takes theatre, movie name,cast,director,language,opendate,closedate(all are stirings). I'm getting their values in the servlet and passing them to the class to do the update.. No exceptions found.. but still the update is not happening...
here is the code below


JSP file


servlet file



class file



please help me...

Dieter Quickfend wrote:You're welcome.



This is my Servlet class


This is the model class



This is the class for getting connection to the Database




This is the code to add a movie to the pyramid table.. When i executed it including main method the insertion is happened but when i removed the main method it's showing an error "Class not foundjava.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
11:10:11,022 INFO [STDOUT] java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
11:10:11,023 INFO [STDOUT] Could not connect to DBjava.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@192.168.1.10:1521:ORCL
11:10:11,024 INFO [STDOUT] Exceptionjava.lang.NullPointerException"


How can i overcome this error? help me


Dieter Quickfend wrote:try using your real IP address instead of localhost.



Thank you very much... It worked!!!The ping succeeded

amit punekar wrote:Hi,
Two things to check
1) Do you see the Class for which ClassNotFound is thrown in the JAR that you added in Eclipse
2) Right click the java project and check the Java Build Path. It should have correct location of the JDBC driver's Jar file.

Regards,
Amit



Thank you Amit For your Reply The ClassNotFound problem is resolved but still i got SQL exception saying that the network adapter could not establish the connection

Dieter Quickfend wrote:Then you have a problem connecting. Check if all your data is correct... Username, password, driver string, hostname, and port.



Username:system
password:default
driver string:jdbc:oracle:thin:@localhost:1521:ORCL
hostname:ORCL

the username and password are working as i checked that with my oracle sql puls..
i'm using eclipse galileo.. In that i created a new database connection selecting Oracle.... In the new Driver definition(oracle thin driver 10) i made modifications like removing the classes14 jar,adding the classes12 jar, setting the SID,username ,password... i made these modifications in the properties also... When i click the test connection button it says the ping failed

James Sabre wrote:You need to add the Oracle JDBC driver jar to your class path. When you use this in your servlet the driver jar must be placed in the WEB-INF/lib directory of your war file.



I'm using eclipse galileo.... still do i need to add? I added the classes12.jar file in my database connections....even the pinging also failed....

Raj Kamal wrote:
Which line throws ClassNotFoundException?



at this line

Class.forName("oracle.jdbc.OracleDriver");
hi my program is unable to connect to the database it shows the ClassNotFound Exception
Below is the Program

package model;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ManageConnectionClass {
private String dbURL="jdbc:oracle:thin:@localhost:1521:ORCL";
private String dbUserName="system";
private String dbPassword="default";

public Connection getConnection(){
Connection conn=null;
try{
try {
Class.forName("oracle.jdbc.OracleDriver");
} catch (ClassNotFoundException e) {
System.out.println("Class not found");
System.out.println(e);
}
conn=DriverManager.getConnection(dbURL,dbUserName,dbPassword);
}
catch(SQLException e){
System.out.println("Could not connect to DB");
}
return conn;
}
public void putConnection(Connection conn){
if(conn!=null)
{
try {
conn.close();
}
catch (SQLException e)
{
System.out.println("Could not close the connection");

}
}
}


public static void main(String args[]){
try {
System.out.println(new ManageConnectionClass().getConnection());
} catch (Exception e) {
System.out.println("Exception"+e);
}

}
}
and i'm invoking this using the main method......... I wasted a whole day for this .... please help me out...