Java ODBC on a web site

anyone know how to incorporate java into a website, so as to connect to a website?
Can you embed the code in java script or anything?
Can anyone help me out?

If you have an application server installed and setup, you can run this simple JSP page, which connects to a database name: dbname, db user id: userid, and password: password. Then run a query to a table hotel, and display field ID from the table.
You just need to copy the code in a file, and give it a name like connect.jsp. Then call this file from a webbrowser, for example:
http://servername/connect.jsp
You don't need an applet on the client. But to run a servlet or a JSP, again, you need to have an application server.
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<html>
<%
String id = null;
try {
     String url = "jdbc:db2:dbname";
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
java.sql.Connection con = DriverManager.getConnection(url,"userid","password");
     Statement stmt1 = con.createStatement();
     ResultSet rs = stmt1.executeQuery("select * from hotel");
     rs.next();
     out.println("ID: " + rs.getString("id") );
     } catch (Exception e) {
          out.println("Connection failed");
%>
<% out.println("J page"); %>
</html>

Similar Messages

  • HELP--Java not working on web sites

    Unable to view any Java based graphic on web sites via Safari, Explorer Netscape or Firefox. Bootcamp/Windows Explorer same problem.
    Computer will not install Java 131 or 141 release2 or J25E5O release4 updates.
    Installation of JavaEmbeddingPlugin 0.9.6.2 2 does not solve problem
    Safari says Java not installed, misc. messages in other browsers
    Machine Name: iMac
    Machine Model: iMac4,1
    Processor Name: Intel Core Duo
    Processor Speed: 1.83 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2
    L2 Cache (per processor): 2 MB
    Memory: 1 GB
    Bus Speed: 667 MHz
    Java Info:
    Kind: Universal
    Get Info String: 11.5.0 (for JDK 1.4.2),
    Location:/Applications/Utilities/Java/Java Web Start.app
    Kind: Universal
    Get Info String: 11.5.0 (for Java 1.4.2),
    Location:/Applications/Utilities/Java/Java 1.4.2 Plugin Settings.app
    Please advise any solutions or my errors??
    Aloha,
    Islandgirl

    Hi to both!
    Assuming your issues arose following recent Software Updates, info in this recently (4/19/07) updated Apple Support article may be useful:
    Mac OS X: Troubleshooting installation and software updates.
    Most of the info and suggestions will be worthwhile even if the issues arose prior to the latest Software Updates. Best of luck with it:)

  • A web wiget using java acript in my web site does not show up with Firefox but does with ie; how can I fix it?

    I have inserted a java script web wiget on my web site by copy and paste. It works fine in IE (shows, updates data etc). In FFox it does not even show up and no error messages are given. If I look at the code in FFox, it is shown. Is there a problem with my web site or am I short something in FFox?

    To avoid confusion:
    *http://kb.mozillazine.org/JavaScript_is_not_Java

  • İs it free to use the "Java Logo" on our web sites.

    Hello
    I am working in a company who develops computer programs with Java. I want to put the Java Logo on my company's web page. Is is free to use the logo? if not, How can I license it?

    http://java.com/en/about/brand/buttons/
    ~

  • Safari is blocking java from an specific web site

    Im trying to watch y survellance camera on safari but doesnt allow me.
    it says tha java is blocked for this web site

    Open the Java pane in System Preferences. A separate application will launch. In the Security tab, check the box marked
    Enable Java content in the browser
    If necessary, adjust the Security Level slider, but if you must reduce the level, do so only temporarily and only if you are absolutely sure of what you're doing.
    If your browser is Safari, you may also need to make changes to the plugin settings in the Security tab of its preferences window.

  • How do I check whether Java is installed on web-user machine via browser?

    Greetings!
    My task is to determine whether the visitor can run java applets on his PC. To know this I need to check whether the visitor has JRE installed.
    I tried to use navigator.javaEnabled() function for this, but actually it gives information only about the browser's permissions.
    Also I tried to use deployJava script for this, but looks like it tried to run some java applet and this raised some popups on my browser. Sometimes it asks the user to permit the evaluation of java, which is not a suitable behavior for me.
    I know there is a page http://www.java.com/en/download/installed.jsp which also checks for java. I lioke this page: it doesn't ask some security permissions and displays the java version correctly.
    So the question is: how can I check java version on some web-site visitor PC reliably and without showing security permission dialogs?

    977564 wrote:
    Also I tried to use deployJava script for thisokay
    I know there is a page http://www.java.com/en/download/installed.jsp which also checks for java. I lioke this page: it doesn't ask some security permissions and displays the java version correctly.
    You know what the joke is? It uses the deployJava script. I did a quick hack check of the page source (wasn't easy since it refreshes really quickly).
    So the question is: how can I check java version on some web-site visitor PC reliably and without showing security permission dialogs?The deployJava script. If you follow in my footsteps you can get the page source of the java.com page as well and "learn" from it. Probably some http sniffer browser plugin or a plugin to get the source of a URL is easier though.

  • Since I upgraded to ios5 safari can't handle the java setting on an internal work web site. When i click on a field it appears to be uncalibrated. How can I add another browser or go back to ios4 till a fix is found?

    My current work around is turning java on and off, but all fields are still not active. Please advise. Thank you.

    JavaScript is a rather flexible language and not always totally cross-browser, so what works with one browser may not work with another, or even in some cases a revision of one that worked before. Absent corrections to the web site, if the site isn't working on your iPad now, you will indeed probably need a different browser. There's no supported way to downgrade your version of iOS, but there are other web browsers available in the iTunes Store, including Opera Mini and iCab Mobile. One of those might be happier with the JavaScript on your web site. Opera is free, so you might want to try that first.
    Regards.

  • Web site with java benchmarks for various cpus?

    Is there a web site that shows java benchmarks run on various P4 and AMD cpus, so that it is possible to see the relatively speed at which java runs on these cpus?

    You'll find a few if you search around, but none will be meaningful. The problem with Java, or any other Virtual Machine type runtime language is you can not design a benchmark that really has meaning, in any context but the benchmark itself. First off, you're not benchmarking "Java" you're benchmarking the "JVM". I try to convince people to not waste so much time on these speed issues. Your time would be better learning how to write better code, which would give a much bigger speed increase then switching from a P4 to an Athlon. Developers often make mistakes and oversites in their work that slows a program down by an order of magnitude. You're never going to see that kind of performance difference in CPUs. So get a good deal on machine, the most "bang-for-your-buck" if you will, and go to town, and stop worrying, hotspot is fast.
    Sparc Chips are different story because a little thing called register coloring... but you didn't mention sparc chips, so I won't tell the story.
    Spinoza

  • Web site with Java Scripts ( on iphone4)

    try to open a web site with Java scripts , but it just show empty on the scripts section , anyone can help ? (on iphone 4 with iOS 4.1)

    Hi, welcome to Apple Discussions.
    Web pages that make use of Javascript should work just fine. Those that have embedded Java applications won't. Java & Javascript are two different animals despite the similarity in the names. Like Flash, Java is not supported on iOS.
    tt2

  • Free, non-commercial java web site

    Free, non-commercial java web site
    I am creating a free, non-commercial web site http://www.myjavaserver.com/~hasstar
    the purpose of this site is to display every thing (tips, tutorials, links, code, examples) I can and I know in java and also some other useful information other than java.
    But the question is from where do I get the information and resources to display on my website?
    Any one who have some resources or information or tips or tutorial or java links, and have no problem to share with me please give it to me . For this I can put a link to your website on my site or a small ad banner on my site.

    why are you creating a JSP resources page if you don't have any resources to put up on it????
    make a "My Favourite TV Programmes" or "My Favourite Recipes" page instead.

  • On certain web sites(with java applets embedded or rich content),sometimes browser hotkeys are beeing used with other functionality (eg.: youtube uses ctrl + tab for sliding between player controls).How can I prevent this?

    On certain web sites(with java applets embedded or rich content),sometimes browser hotkeys are beeing used with other functionality (eg.: youtube uses ctrl + tab for sliding between player controls).How can I prevent this ?

    Thanks for posting this!
    I would only mention that your definition is incomplete for this -
    Contextual selector A type of Style Sheet Selector that
    and that it's most often referred to now as a Descendent selector, not a contextual selector.  It's basically the same as the Compound selector that you have already defined....

  • The web site uses java is this available for mozilla moble and if so where can i get it?

    tried to view a camera feed through the web site when i did it with my pc i had to add a java add-on but i can't find one for the mobile version...do you have any suggestions
    thanks

    https://support.mozilla.com/en-US/questions/815161
    No Java for Android yet.
    The Oracle vs. Google Android lawsuit does not help either.
    http://www.zdnet.com/blog/open-source/oracle-vs-google-android-java-lawsuit-settlement-talks-will-go-no-where/9580

  • M trying to open a java web site its not opening and server goes to java website...??

    m trying to open a java web site its not opening and server goes to java web sites ...........???

    Java is not available for iOS devices, so the site you are trying to access won't work.

  • Manipulating a web site via a JAVA App

    Hi,
    can I use html code of a web site, eg Wikipedia to control its dynamic pages via a JAVA application??? To make it a bit more clear, if I retrieve the html code of wikipedia, and therefor know where the search text field is, can I insert there some info, like JAVA for example, hit the search button via my app, and retrieve the html code of the pages posted back to read the information provided for the search word JAVA??? I dont know if its clear what I want to do...I did my best though
    cheers

    jwenting wrote:
    Looks like he wants to make a bot that harvests content from websites and/or engages in comment spam on (for example) blogs.
    The first is (usually) a violation of the terms of use of a website, the second (and possibly the first) is unethical to say the least.Looks like you jump to conclusion very quickly...Maybe I want to make an application and take over the WORLD!!!

  • Problem w/ a dialup connection and Java web site sessions timing out.

    Anytime a web site that uses a Java in a pop up box times out, the longer the time afterwards that there is no user response the worse the problems get.
    The page freezes, then the browser, it can't be closed w/o using task manager,
    The dialup adapter freezes (cant be disconnected).
    It doesn't seem to happen with a broadband connection.
    I have tried XP Pro w/sp2, XP Pro w/sp1a, 2000 w/ sp4 and all have the same problem.
    I have tried a different hardware modem (orginal is a software modem) and the same thing.
    I have tried older versions of Java, but the same. thing.
    This happens on two different boxes (motherboards).
    The sites involved are Yahoo card games chat sessions & Ameriatrade stock quotes sessions. The ISP is Earthlink.
    Normal surfing is unaffected. This happens with Firefox & Opera and I believe Idiot Exploiter (whichisn't used).
    One box is a Dell/Wintel and w/ the orginal setup (XP Home modified by Dell), worked w/ no issues. Dell says Java V1.5 was used (which I tried). I don't thik it is a O/S issue.
    Regarding older versions of Java, anyone suggest one that doesn't have these issues??
    BTW, no viruses and these were all fresh installs w/ the latest drivers.

    In a thread about problems with Yahoo, someone noticed that your session can prematurely time out if you have set proxy to auto-detect here:
    orange Firefox button ''or'' classic Tools menu > Options > Advanced > Network > "Settings" button
    Could you test with the setting on No proxy or Use system proxy settings and see whether it helps?

Maybe you are looking for