• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 244
  • Last Modified:

Accessinf Sybase ASE from a JSP Page

My JSP is on Linux Redhat7.1 and the RDBMS is SybaseASE 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-

testinf JSPPage
<%!String username = "sa";
 String password = "";%>
    {     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())
      {                        %>
   }     catch(Exception e)
<b>Error : </b>
      <%= e.toString() %>
<%      }%>


Do I have to do other setup changes etc???
Pls. help
  • 6
  • 4
1 Solution
where do you reside the com.sybase.jdbc2.jdbc.SybDriver package?

Dose it exist in {tomcat path}/webapps/{appname}/WEB-INF/lib/ ?
chaiti_cAuthor Commented:
I have loaded copied jConnect5-5 under root . I have set the path in the the CLASSPATH as well.
So strange put it under root. Can you try to put it under the path I suggested?
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

chaiti_cAuthor Commented:
Yes the entire directory is under root. I cannot put the files directly under /
put the jConnect5-5.zip in
  {tomcat path}/webapps/{appname}/WEB-INF/lib/
chaiti_cAuthor Commented:
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
No need the directory jConnect5-5, put the zip under ../lib/.
chaiti_cAuthor Commented:
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
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

or you may put under

which is accessible to all web application.

Tell me does it work.
Remmeber to restart your tomcat server to take effect.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now