Eclipse-how to work with simple program

Hi all

I have downloaded Ecllipse. i have an ecllipse folder in desktop.

how to work simple program in that.

i think ecclipse  is anIDE environment.could i need to download any other tool

for working with ecclipse.

This is my sample program.

<%@ page language = "java" import ="java.sql.*" %>
<html>
<body>
<%
Connection con = null;

try
{
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      con = DriverManager.getConnection("jdbc:odbc:ss","sa","");
      Statement st = con.createStatement();
      ResultSet rs = st.executeQuery("select * from customer");
      %>
            <table border =2>
            <%
            while(rs.next())
      {
            %>
            <tr>
            <td><%= rs.getString(1)%></td>

            <td><%= rs.getString(2)%></td>

            <td><%= rs.getString(3)%></td>

            </tr>

            <%
      }
            %>
            </table>
            <%
}
            catch(Exception d)
            {
                  out.println("can not display the records");

            }
            %>
            </body>
            </html>
How to save this program and test the program in ecclipse.

I aware that Hibernate . could i down load hibernate ?

which one is better, ecclipse or hibernate  

which tool should be better for test this program.I have sqlserver 2005.
LVL 9
Manikandan ThiagarajanSenior consultantAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

radarshCommented:
Hi stmani2005,

Since it is a JSP, you have to create a Dynamic Web Project in Eclipse.
choose Tomcat as the server (or any other). Save this JSP inside the WebContent
folder in your project. Put the JAR files you need for oracle driver in the WEB-INF\lib
directory. If you get a ClassNotFoundException, you need to double-click on the server
and click on the "Open Launch Configuration" link and add the JAR file for driver there.

After you've done all this, right-click on the JSP and select Run As -> Run On Server

That should open a Web Browser window for you in Eclipse.
________
radarsh
radarshCommented:
Hibernate is not an IDE. Its a technology for Data Persistence. Eclipse
is an IDE where you can work on many kinds of projects.
Manikandan ThiagarajanSenior consultantAuthor Commented:
>>you have to create a Dynamic Web Project in Eclipse

where i see the option in ecclipse?

how do i select the tomcat server
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

radarshCommented:
stmani2005,

go to File -> New -> Project -> Web -> Dynamic Web Project

Forgot to mention one very important thing here. You need to have
the eclipse with Web Tools Plugin distribution. You can download it
here...

http://download.eclipse.org/webtools/downloads/

________
radarsh
Manikandan ThiagarajanSenior consultantAuthor Commented:
could you specify the name of the link to download for webtool
radarshCommented:
>>could you specify the name of the link to download for webtool

What I specified in previous post is called a link.

________
radarsh
Manikandan ThiagarajanSenior consultantAuthor Commented:
wtp-all-in-one-sdk-1.0-win32.zip.

is this a  file i have to download?

where i save it?
radarshCommented:
stmani2005,

Exactly!! That "is" the file. Its is eclipse itself but with the
additional plugins. Extract and start using it.
________
radarsh
Giant2Commented:
>Extract and start using it.

sometimes when you add a plug-in eclipse you need to restart Eclipse itself to take the new changes.
radarshCommented:
This the bundled version of eclipse. Not the plugin itself.
So, essentially you are installing a new eclipse.

The concept of restarting doesn't arise when you haven't started it at all!!

:)

________
radarsh
Manikandan ThiagarajanSenior consultantAuthor Commented:


HI Radarsh,Giant

i create a  context root under dyanmic web project. that name is called jdbc jsp.

where i could paste the above code and test that jsp code.

could you please explain simple?
Giant2Commented:
In eclipse you can cut/copy/paste any file directly from the tree at left side.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Manikandan ThiagarajanSenior consultantAuthor Commented:
well , i paste the code and save it as jdbc.jsp under jdbcjsp

how to connect with tomcat server and run this program?.

if i  click run button that gives the output for previous helloworld program.

how to change this program in to runtime environment?
Giant2Commented:
you may set your jdbc.jsp file answer to request.
You must define the context (if not defined) and so on. The same things if your are working with Tomcat.
Manikandan ThiagarajanSenior consultantAuthor Commented:
hi,i set context jdbcjsp inside the tree view i have jdbc.jsp

how to run jdbc.jsp.
Manikandan ThiagarajanSenior consultantAuthor Commented:
it doesnot support tomcat 4.1 it support only tomcat 5.0 and tomcat 5.5

i have only tomcat 4.1 version.

what i do now?
radarshCommented:
You right-click on your JSP and select

Run As -> Run on Server


________
radarsh
Manikandan ThiagarajanSenior consultantAuthor Commented:
i clck that run on server  select default server

when i click run after that i enter into create manage and run configuration wizard.

what i specify debug and run text boxes





Manikandan ThiagarajanSenior consultantAuthor Commented:
now i install tomcat5.5

i have jdbcjsp folder ---webcontent---jdbc.jsp

when i right click jdbc.jsp and select run as on server


 that would shows the error like no launchable artifact could be found this session

when i right click jsbcjsp folder and select runon server,it starts the server

it open the browser and says  the page can not be displayed

the url like http://localhost:8080/jdbcjsp

could you please explain step by step to solve the problem?


Giant2Commented:
>http://localhost:8080/jdbcjsp
I do not see the DOT "."  Maybe you forget during editing file?
Manikandan ThiagarajanSenior consultantAuthor Commented:
when i right click jdbc.jsp and select run as on server
 that would shows the error like" no launchable artifact could be found this session"

how to solve that error

Giant2Commented:
see the log because I think you didn't put the jsp in the right WebContent
Manikandan ThiagarajanSenior consultantAuthor Commented:
where i go to see the log
Giant2Commented:
If you use the inner Tomcat (buld in Eclipse), you can find something in the Window->Show View->Other and search for the tomcat log
radarshCommented:
Where did u put ur JSP? Under which directory? Can you give the tree structure? Something like this...

-Root
    -WEB-INF
        +classes
        +lib
         web.xml
 jdbc.jsp


________
radarsh
Manikandan ThiagarajanSenior consultantAuthor Commented:
-Root - jdbcjsp

                 -src

                -Webapplibaries

                  -build

-webcontent

         Meta-inf

         web -inf

             web.xml

        jdbc.jsp


is that correct

Manikandan ThiagarajanSenior consultantAuthor Commented:
now i start the server from ecclipse that would started.now that would not open any browser.i could not able to see any output.

could i supply any url to see the output.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.