| Author |
method calling
|
amit taneja
Ranch Hand
Joined: Mar 14, 2003
Posts: 806
|
|
Hi, i m facing a urgent problem which i have to show to boss... the problem that is comming is...calling method "getConnection(String) which in details is as follow public Connection getConnection(String dbasename) { String userName = "sa"; String password = "sa"; Connection con =null; String dbDriver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; String url= "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName="+dbasename; try { Class.forName(dbDriver); con = DriverManager.getConnection(url,userName,password); } catch(Exception e) { System.out.println("Exception caught "+e); e.printStackTrace(); } return con; } This method making a connection with mssql2k server and returning the Connection object.. when i call this method by passing String like getConnection("employee"); where "employee" is the name of the database. everything is working fine but when i m passing the variable object as String like String database = request.getParameter("db"); where db has "employee" value and calling the method getConnection(database); nothing is working pls pls can anybody tell why this is happening its really urgent and i have to show to my boss thanx in advance .. regards, amit taneja [Bear edit: not so urgent] [ December 21, 2004: Message edited by: Bear Bibeault ]
|
Thanks and Regards,<br />Amit Taneja
|
 |
amit taneja
Ranch Hand
Joined: Mar 14, 2003
Posts: 806
|
|
The error page show is The page cannot be displayed HTTP 500 - Internal server error Internet Explorer pls tell me what to do ??? can anybody tell me why the error is comming ?
|
 |
Jeroen Wenting
Ranch Hand
Joined: Oct 12, 2000
Posts: 5093
|
|
|
not urgent, may look into it sometime next year.
|
42
|
 |
Srinivasa Raghavan
Ranch Hand
Joined: Sep 28, 2004
Posts: 1228
|
|
Originally posted by amit taneja: The error page show is The page cannot be displayed HTTP 500 - Internal server error Internet Explorer pls tell me what to do ???
May be the server is waiting for the connection object for a long time, since it dint get the connection for a long time you are getting this. I got the same type of Exception when a call was made to a external application through API. That application does some DB related stuff, there was some connection pool error ( may be the number of open connections exceeded the maxiumum limit ) the JSP was waiting for some time & i got this page even though isErrorPage is set to an error page.
|
Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
|
 |
Nitin Jawarkar
Ranch Hand
Joined: Dec 18, 2004
Posts: 79
|
|
Dear Amit, It may occur due to u r server reponce time.
|
Cheers<br />Nitin
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Though I tend to agree with Jeroen with regards to the title of this post, you will need to read the "Internal server error" to have any hope of progressing. It will be being logged on the server console or to a file (consult your Servlet container's documentation if you are not sure). You could also set your browser to show more than just friendly error messages (again, read the docs). There are a number of reasons why your code might be failing but none are obvious from what you've posted so far. [ December 21, 2004: Message edited by: Paul Sturrock ]
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
amit taneja
Ranch Hand
Joined: Mar 14, 2003
Posts: 806
|
|
hi i m sure thsi is not the error...... as ppl did'nt understand the problemm... see i m saying that getConnections is working fine when u sing as getConnection("employee"); but not when using as getConnection(Stringvariable); where Stringvariable is containg the value "employee" thats it.. there is no correlation of server late reponse time ... and if that is the case then the program shouldn't run fine in any case.. see here i m using variable because i putting value to Stringvariable=request.getParameter("some_name_of_other_html_field"); thats it... i will appreciate any logical answer thanx Regards, Amit
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12268
|
|
If you get
The page cannot be displayed HTTP 500 - Internal server error Internet Explorer
There is almost certainly a log entry somewhere that was written when that error occurred. You should also turn off the accursed "Friendly Http error message" setting on your MSIE (tools -> internet options -> advanced ->browsing) - perhaps the server is actually sending a useful error message. (why do people think that a post title "very urgent.." gets more attention than a title that summarizes the problem??) Bill
|
Java Resources at www.wbrogden.com
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Well, you are still not making this easy amit taneja, since you still have not told us the exception you are seeing which is the method Java uses to tell a programmer what is wrong, but I would guess that (since you don't check for it) the database name could well be null or a non-existant database. If you posted the exception, I (or someone else) would possibly be able to tell you for sure. [ December 21, 2004: Message edited by: Paul Sturrock ]
|
 |
Sandeep Deshmukh
Greenhorn
Joined: Dec 06, 2004
Posts: 16
|
|
Hi amit I think you must put a log like System.out.println(request.getParameter("db")); before you pass it to your getConnection() so that you can check correctness of response recieved. You may get error but as you have put the logs you will find answer to what may be wrong. Best of luck. Sandeep
|
Java and Oracle Programmer
|
 |
 |
|
|
subject: method calling
|
|
|