Honesty Rocks! truth rules.

My Code Does Not Connect To Database always databases

HOME      >>       Programming

alexviii

Hi everyone!

i am having a database connection problem,
i am using this code to connet to the database -

*******************attempCounter = 0****

public static Connection getDbConnection(String p_db, String p_schema){Connection conn = null;int attemptCounter = 0;while (conn==null && attemptCounter<3){attemptCounter++;try{ResourceBundle rb = ResourceBundle.getBundle("hailEss");String dbName = rb.getString("db.name." + p_db);//if(p_schema.equals("custom"))//p_schema="haileip";String dbUser = p_schema;String dbPass = rb.getString("db.pass." + p_db + "." + p_schema);System.out.println(dbName);System.out.println(dbUser);System.out.println(dbPass);Class.forName("oracle.jdbc.driver.OracleDriver");conn = DriverManager.getConnection(dbName,dbUser,dbPass);}catch(Exception genEx){EssLocalLogger logMakerObj = new EssLocalLogger();logMakerObj.error("Source ConnectionManager.getDbConnection(): " + attemptCounter + " - " + genEx.toString());}}return conn;}

********************

now the problem is when i run this class i get the connection in the first place itself, but when i call this through a jsp page it tries for 3 times, it gets the connection and comes out with this error which is why i am able to proceed firther----

****************** Exception: java.sql.SQLException: ORA-00600: internal error code, arguments: [tt
cgcshnd-1], [0], [], [], [], [], [], []
******************


PLEASE HELP!!

beeseven

If it works on its own but not on the JSP page, is it possible that the problem is there? Also, why do you have the Class.forName call if you don't assign the result to anything?