• Post Reply Bookmark Topic Watch Topic
  • New Topic

DB connection

 
amit bhadre
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to connect to database through JSP page..? I written the java file to connect to data base.Class file I included in <jsp:useBean id="login" scope="page" class="MsDBCon"/>

Ths MsDBCon is Java class file to connect to DB MS-SQL server. How to do ?
I placed the class file in web-inf/classes directory.

The jsp page Throwing Exception as


An error occurred at line: 2 in the jsp file: /LoginDB.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\LoginDB_jsp.java:44: cannot find symbol
symbol : class MsJdbcCon
location: class org.apache.jsp.LoginDB_jsp
MsJdbcCon login = null;
^



An error occurred at line: 2 in the jsp file: /LoginDB.jsp

Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\LoginDB_jsp.java:46: cannot find symbol
symbol : class MsJdbcCon
location: class org.apache.jsp.LoginDB_jsp
login = (MsJdbcCon) _jspx_page_context.getAttribute("login", PageContext.PAGE_SCOPE);
^



An error occurred at line: 2 in the jsp file: /LoginDB.jsp

Generated servlet error:
C:\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\LoginDB_jsp.java:48: cannot find symbol
symbol : class MsJdbcCon
location: class org.apache.jsp.LoginDB_jsp
login = new MsJdbcCon();
^
3 errors
[ June 03, 2006: Message edited by: amit bhadre ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
 
Peter Petrov
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MsJdbcCon or MsDBCon, what is the name of your class?

Seems it is the second one.

And in your source file (i.e. in your JSP) you define
your variable to be of type MsJdbcCon...
And as far as I understand the compiler just
says: "well, i do not know any class named MsJdbcCon"
which is quite logical. You import MsDBCon in your JSP
but you trying to use a class named MsJdbcCon.

Hope this helps.
[ June 03, 2006: Message edited by: Peter Petrov ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!