HOME       >>       Programming

My Code Does Not Connect To Database always databases


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], [], [], [], [], [], []



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?


Xisto.com offers Free Web Hosting to its Members for their participation in this Community. We moderate all content posted here but we cannot warrant full correctness of all content. While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2001-2019 by Xisto Corporation. All Rights Reserved.