Solved

Accessinf Sybase ASE 11.0.3.3 from a JSP Page

Posted on 2002-03-06
10
229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
10 Comments
 
LVL 6

Expert Comment

by:kotan
ID: 6846502
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
ID: 6849547
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
ID: 6849567
So strange put it under root. Can you try to put it under the path I suggested?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

Expert Comment

by:kotan
ID: 6849968
put the jConnect5-5.zip in
  {tomcat path}/webapps/{appname}/WEB-INF/lib/
0
 

Author Comment

by:chaiti_c
ID: 6852277
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
ID: 6855045
No need the directory jConnect5-5, put the zip under ../lib/.
0
 

Author Comment

by:chaiti_c
ID: 6855925
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
ID: 6855964
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
ID: 6855965
Remmeber to restart your tomcat server to take effect.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
attribute vs parameter and setter vs add method 17 97
spring JDBC Template example error 26 356
Java Script nested call 3 91
print map entry 34 79
The goal of this blog is: - To define the incident management process - To go over the key elements of an incident management system - To look into incident alert management tools that integrate with ConnectWise.
A big percent of today’s marketing activity is performed through the online environment. The marketing strategies that have existed a decade ago no longer relate to what’s happening today. We’re currently facing a revolutionary era, called the digit…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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