Solved

Accessinf Sybase ASE 11.0.3.3 from a JSP Page

Posted on 2002-03-06
10
210 Views
Last Modified: 2008-02-01
My JSP is on Linux Redhat7.1 and the RDBMS is SybaseASE 11.0.3.3. I have Jakarta Tomcat running and and copied the jconnect5-5. I am trying to access a Sybase database from an JSP page and am getting the following error-
Error :  java.lang.ClassNotFoundException: Unable to load class com.sybase.jdbc2.jdbc.SybDriver

The code is as follows-

<html>
<head>
<title>
testinf JSPPage
</title>
</head>
<body>
<%!String username = "sa";
 String password = "";%>
<%
  try
    {     Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
     java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:sybase:Tds:localhost:7101",username,password);
     java.sql.Statement stmt = con.createStatement();
     java.sql.ResultSet rs = stmt.executeQuery("SELECT * from javatest ");
%>
<table >
<%
       while (rs.next())
      {                        %>
<tr>
<td>
<%=rs.getString()%>
</td>
</tr>
 <%          
}  
   }     catch(Exception e)
      {%>
<b>Error : </b>
      <%= e.toString() %>
<%      }%>
</table>

</table>
</body>
</html>

Do I have to do other setup changes etc???
Pls. help
Regards
Chaitali
0
Comment
Question by:chaiti_c
  • 6
  • 4
10 Comments
 
LVL 6

Expert Comment

by:kotan
Comment Utility
where do you reside the com.sybase.jdbc2.jdbc.SybDriver package?

Dose it exist in {tomcat path}/webapps/{appname}/WEB-INF/lib/ ?
0
 

Author Comment

by:chaiti_c
Comment Utility
I have loaded copied jConnect5-5 under root . I have set the path in the the CLASSPATH as well.
0
 
LVL 6

Expert Comment

by:kotan
Comment Utility
So strange put it under root. Can you try to put it under the path I suggested?
0
 

Author Comment

by:chaiti_c
Comment Utility
Yes the entire directory is under root. I cannot put the files directly under /
0
 
LVL 6

Expert Comment

by:kotan
Comment Utility
put the jConnect5-5.zip in
  {tomcat path}/webapps/{appname}/WEB-INF/lib/
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:chaiti_c
Comment Utility
I have just done it this way- i copied the files form the zip into a directory called jConnect5-5 under /jakarta_tomact/webapps/{appname}/WEB-INF/lib/ bit it is still giving the same error. Do I have to specify the paths anywhere else other than the .bash_profile
0
 
LVL 6

Expert Comment

by:kotan
Comment Utility
No need the directory jConnect5-5, put the zip under ../lib/.
0
 

Author Comment

by:chaiti_c
Comment Utility
Yes I have done that now.
Is any other configuration required for this. What if i put it in a class file and then access that file ?? If I have to access a class file do I need further configuration changes. I have changed it and have put the entire stuff in a java file which is getting compiled now I am trying to access this class but then also I am getting error
0
 
LVL 6

Expert Comment

by:kotan
Comment Utility
Sorry, I have made some mistake.
I have download the jConnect-5_5.zip and unzip it. I saw it there is a jar file call "jconn2.jar" under ../jConnect-5_5.zip/classes. This jar file consist of all the jdbc classes.

This is the jar file you need to locate at the
  {tomcat_dir}/webapps/{webapploc}/WEB-INF/lib/

or you may put under

  {tomcat_dir}/lib/
which is accessible to all web application.

Tell me does it work.
0
 
LVL 6

Accepted Solution

by:
kotan earned 300 total points
Comment Utility
Remmeber to restart your tomcat server to take effect.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now