A newbie question - Websphere

This is a discussion on A newbie question - Websphere ; Hi everyone, I am pretty new to Websphere and the Studio Site Developper. I just finished to install it on my machine and I try to create a simple database connection via the JDBC:ODBC bridge in a JSP page and ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: A newbie question

  1. A newbie question

    Hi everyone,

    I am pretty new to Websphere and the Studio Site Developper. I just finished
    to install it on my machine and I try to create a simple database connection
    via the JDBC:ODBC bridge in a JSP page and I always have the same error
    repeating (java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver).
    I created a new Test Environment server, but I really don't know how to
    configure it, and I think there is the problem, the server doesn't know
    where the classes are... Isn't it strange that by default the server does
    not references to any classes that are I think common in java ??? Here is
    the sample of my code :

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

    Connection conn =
    DriverManager.getConnection("jdbcdbc:TestWebsphere","sa","password");

    Statement stmt = conn.createStatement();

    ResultSet res = stmt.executeQuery("SELECT * FROM Client_clients");

    I take care of using the correct import at the very beginning of my page :

    <%@ page import="java.io.*" %>

    <%@ page import="java.sql.*" %>

    <%@ page import="java.util.*" %>

    <%@ page import="javax.naming.*" %>

    <%@ page import="javax.sql.*" %>



    Hope somone helps because I am really blocked now...

    Thanx

    Philippe Meunier, Programmer, Cybergeneration




  2. Re: A newbie question

    Philippe Meunier wrote:

    > Hi everyone,
    >
    > I am pretty new to Websphere and the Studio Site Developper. I just finished
    > to install it on my machine and I try to create a simple database connection
    > via the JDBC:ODBC bridge in a JSP page and I always have the same error
    > repeating (java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver).
    > I created a new Test Environment server, but I really don't know how to
    > configure it, and I think there is the problem, the server doesn't know
    > where the classes are... Isn't it strange that by default the server does
    > not references to any classes that are I think common in java ??? Here is
    > the sample of my code :
    >
    > Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    >
    > Connection conn =
    > DriverManager.getConnection("jdbcdbc:TestWebsphere","sa","password");
    >
    > Statement stmt = conn.createStatement();
    >
    > ResultSet res = stmt.executeQuery("SELECT * FROM Client_clients");
    >
    > I take care of using the correct import at the very beginning of my page :
    >
    > <%@ page import="java.io.*" %>
    >
    > <%@ page import="java.sql.*" %>
    >
    > <%@ page import="java.util.*" %>
    >
    > <%@ page import="javax.naming.*" %>
    >
    > <%@ page import="javax.sql.*" %>
    >
    >
    >
    > Hope somone helps because I am really blocked now...


    No database driver is part of the standard so you have to find the
    correct jar/zip for the driver and explicitly put it on the app server's
    classpath. You'll also have to put the j2ee jar on the path explicitly.
    You also ought to get your company to put you through a couple of IBM's
    beginning servlet/jsp classes so you can learn how to build your apps
    correctly using MVC and proper separation of concerns.

+ Reply to Thread