aspose file tools*
The moose likes JSP and the fly likes JSP error: invalid arguments in call . PLEASE HELP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP error: invalid arguments in call . PLEASE HELP " Watch "JSP error: invalid arguments in call . PLEASE HELP " New topic
Author

JSP error: invalid arguments in call . PLEASE HELP

G Gopal
Greenhorn

Joined: Sep 24, 2003
Posts: 4
Hello:
I am running tomcat 5.0 on W2K. I am new to java, jsp and tomcat. I have created a JSP page which will retrieve records from an oracle table. I am getting an error meesage stating: invalid arguments in call . Can some one please help me. Here is the code:
<html>
<head>
<title>
Oracle JDBC Bean & Tomcat JSP
</title>
</head>
<body>
<h1>Employee Table</h1>
<table border="1" width="400">
<tr>
<td><b>File_Name</b></td>
<td><b>Load_FLG</b></td>
<td><b>Facility_NBR</b></td>
<td><b>Load Status</b></td>
<td><b>Migragte Flag</b></td>
<td><b>Load ID</b></td>
<td><b>History Start</b></td>
<td><b>History End</b></td>
</tr>

<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%
// Identify a carriage return character for each output line
try {
// The HTTP request's parameters to get a database connection
String servernm = "DWHSE";
String database = "P002";
String username = "DM_DATA";
String password = "DM_DATA";
// We access the database directly from the JSP with the Oracle JDBC driver
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
// Define connection string and make a connection to database
Connection conn = DriverManager.getConnection("jdbc racle:thin:@DWHSE:1521 002, DM_DATA, DM_DATA");
Statement stat = conn.createStatement();
// Create a recordset
ResultSet rset = stat.executeQuery("Select * From load_status");
// Expecting at least one record
if( !rset.next() ) {
throw new IllegalArgumentException("No data found for the Cars table");
}
while(rset.next()) {
String empno = rset.getString("FILE_NAME");
String ename = rset.getString("LOAD_FLG");
String job = rset.getString("FACILITY_NBR");
String mgr = rset.getString("LOAD_STATUS_TIMESTAMP");
String hiredate = rset.getString("MIGRATE_HISTORY_FLG");
String sal = rset.getString("LOAD_ID");
String comm = rset.getString("HISTORY_LOAD_START_TIMESTAMP");
String deptno = rset.getString("HISTORY_LOAD_END_TIMESTAMP");
%>
<tr>
<td><%= empno %></td>
<td><%= ename %></td>
<td><%= job %></td>
<td><%= mgr %></td>
<td><%= hiredate %></td>
<td><%= sal %></td>
<td><%= comm %></td>
<td><%= deptno %></td>
</tr>
<%
}
rset.close();
stat.close();
conn.close();
}
catch( Exception er ) {
%>
<exception><%= er.getMessage()%></exception>
<%

}
%>

</table>
</body>
</html>
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12805
    
    5
I think you are trying to do too much in JSP - try creating a Java "helper" class to conduct the actual query. Typically this is done as a "JavaBean".
You can test and debug that class outside the JSP environment. Then, when you are sure it is working you can use it inside a JSP.
Bill
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
Hi
Hi
Connection conn = DriverManager.getConnection("jdbc racle:thin:@DWHSE:1521 002, DM_DATA, DM_DATA");

You are using the method getConnection(String url, String username, String password) which takes three arguments.
You have misplaced the double quote.
-------------
Sainudheen
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Listen to William for he is wise. The best practice is to factor as much processing as possible out of the JSP pages. The Java that remains in your JSP should be there in order to format the display.
For each snippet of Java in your page, ask yourself "is this Java here to help render the view?". If the answer is no, it doesn't belong on the page and should be moved elsewhere.
Long term, the best thing you can do for yourself is to study the Model 2 architectural pattern. You will someday thank yourself for doing so.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP error: invalid arguments in call . PLEASE HELP