Cannot import java.sql.BaseQuery

Hi,
I am trying to run the following example using JDK6:
import java.sql.BaseQuery;
import java.sql.DataSet;
import java.sql.Select;
public interface UserQueries extends BaseQuery {
    // Select all users
    @Select (sql ="SELECT userId, firstName, lastName FROM Users",
             readOnly=false, connected=false, tableName="Users")
    DataSet<User> getAllUsers ();
    // Select user by name */
    @Select (sql ="SELECT userId, firstName, lastName FROM Users"
             + "WHERE userName=?", readOnly=false, connected=false,
             tableName ="Users")
    DataSet<User> getUserByName(String userName);
}But I get the error in the import statement itlself. It is not able to import these classe-
import java.sql.BaseQuery;
import java.sql.DataSet;
import java.sql.Select;
Are they shipped with JDK 6?
thnx
Sanjeev.

Because those classes don't exist. A simple, and very quick, perusal of the API docs would have told you this.
http://java.sun.com/javase/6/docs/api/index.html

Similar Messages

  • Connection error using import java.sql.*;

    I have a very strange error. See the code below:
    import java.sql.*;
    import java.lang.*;
    class a7 {
    public static void main(String args[]) {
    String kolom,ko = new String();
    String db = "devarbn1";
    String url = "jdbc:odbc:"+db;
    String login = "arbor";
    String password = "arbor123";
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String BasisQuery = "select COLUMN_NAME " +
    " from all_tab_columns " +
    " where table_name = ? ";
    System.out.println("Database: " + db);
    Connection con;
    try { 
    Class.forName(driver);
    } catch (java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    con = DriverManager.getConnection(url,login,password); //this line gives an error!!!
    and so on.....
    This is a fragment of the whole program. All of a sudden I cannot compile it anymore using jdk1.3 or jdk 1.4 (I never had compiling problems before with this program)
    It gives the following error message: incompatible types, found Connection.
    I haven't got a clue what went wrong. I have a lot of other java files in which a connection is involved. I cannot compile any of them anymore. Even reinstalling jdk1.4 or 1.3 doesn't help. Can anyone please help me?
    Thanx, debeumers

    Yes, the whole message is:
    incompatible types found : java.sql.Connection required : Connection.
    The whole code is (it is from a different java file then the code I used before)
    import javax.sql.*;
    import java.sql.*;
    import java.lang.*;
    public class Connection {
    static final String arb_nl = "arbornl";
    static final String arb_fr = "arborfr";
    static final String clar_nl = "clarnl";
    static final String clar_fr = "clarfr";
    static final String po = "pcnlpp";
    static final String user_clar_nl = "report";
    static final String pass_clar_nl = " r3p0rt";
    static final String user_clar_fr = "report";
    static final String pass_clar_fr = " r3p0rt";
    static final String user_arb_fr = "report";
    static final String pass_arb_fr = " r3p0rt";
    static final String user_arb_nl = "report";
    static final String pass_arb_nl = " r3p0rt";
    static final String user_po_nl = "report";
    static final String pass_po_nl = "r3p0rt";
    static boolean a = true;
    static boolean b = true;
    static boolean c = true;
    static Connection conarb,conclar,conpo;
    static String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String loginarb = user_arb_nl;
    String passwordarb = pass_arb_nl;
    String loginclar = user_clar_nl;
    String loginpo = user_po_nl;
    String passwordpo = pass_po_nl;
    String passwordclar = pass_clar_nl;
    public Connection() {
    public void makeConnection(String database,String user,String password,String type) {
    String url = "jdbc:odbc:" + database;
    try { 
    Class.forName(driver);
    } catch (java.lang.ClassNotFoundException ex) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(ex.getMessage());
    a = false;
    try { if (type=="ARB")  { conarb = DriverManager.getConnection(url,user,password);} //giving the problem!!
    if (type=="CLAR") { conclar = DriverManager.getConnection(url,user,password);} //giving the problem!!
    } catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    b = false;
    /* try { if (type=="PO") {conpo = DriverManager.getConnection(url,user,password);}
    } catch(SQLException ex) {System.err.println("SQLException: " + ex.getMessage()); c = false;}*/
    I hope you can help..
    Thanks...debeumers

  • How can i import java.sql package for midlet development

    I am trying to write a midlet app using Wireless Toolkit 2.5.2. I would like to connect my application to JavaDB in embedded mode. But when I write "import java.sql.*;", I get an error "package java.sql does not exist
    ". I would like to know how can i include this package. please help.

    FBL wrote:
    Sorry to jump in, but isn't there limited jdbc using unconventional methods?
    [http://developers.sun.com/mobility/configurations/articles/cdc/jdbc/|http://developers.sun.com/mobility/configurations/articles/cdc/jdbc/]
    If so, I feel this may better answer the OPs question.
    -TresAbove article refers to CDC - it is useless in CLDC midlets

  • Import java.sql.*

    I am trying to create and application that connects to a database (MySQL) to do some queries. I put this
    import java.sql.*;
    at the top of my file and got this error message "package java.sql does not exist".
    Can anyone shed some light on this for me? :)

    My other guess is a typo, perhaps with an invisible/hard-to-see character. Delete the line and type it in, again.

  • Problems with importing java.sql.*

    Hi.
    When I'm compiling the following code I get this message:
    SimpeltDatabaseEksempel.java:4: Package java.sql not found in import import java.sql.*
    What could be wrong?
    /lars
    Here is my code:
    import java.sql.*;
    public class SimpeltDatabaseeksempel
         public static void main(String[] arg) throws Exception
              // Udskift med din egen databasedriver og -URL
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Connection forb = DriverManager.getConnection("jdbc:odbc:datakilde1");
              Statement stmt = forb.createStatement();
              stmt.executeUpdate("create table KUNDER (NAVN varchar(32), KREDIT float)" );
              stmt.executeUpdate("insert into KUNDER values('Jacob', -1799)");
              stmt.executeUpdate("insert into KUNDER values('Brian', 0)");
    }

    Don't know what to tell you, except that it exists
    http://java.sun.com/j2se/1.5.0/docs/api/java/sql/package-summary.html
    What version of java are you using?

  • The import java.sql.Savepoint cannot be resolved

    i am unable how to resolve this problem please anyone can help me about this

    Which version of Java are you using? Class java.sql.Savepoint was introduced in version 1.4. If you're using an older version, it won't work.

  • Cannot Import Java Classes

    I am trying to do the sample contact walkthrough in FLEX
    builder. For the Java Adapter.
    http://livedocs.macromedia.com/flex/2/docs/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00000138 .html
    I cannot get any import statements to work for the java class
    files. I have tried this using the FDS as a J2EE application
    running in tomcat, I have tried with the standalone JRUN version of
    the FDS app.
    I have put the contact files everywhere I can think of, in
    the server classes folder, in the project, in the default web
    folder and nothing I try works. I have even setup the project to
    compile on the server and I get nothing. Everytime, I get errors.
    I did the tutorial from the JDJ magazine:
    http://java.sys-con.com/read/210991.htm
    I cant get that java connection to work either. Please
    someone help me.
    The flex code is below.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.data.DataService;
    import mx.collections.ArrayCollection;
    import samples.contact.Contact;
    public var ds:DataService;
    [Bindable]
    public var contacts:ArrayCollection;
    //public var contact:Contact;
    ]]>
    </mx:Script>
    <mx:DataGrid id="dg" editable="true">
    <mx:columns>
    <mx:DataGridColumn dataField="contactId" headerText="Id"
    editable="false"/>
    <mx:DataGridColumn dataField="firstName"
    headerText="First Name"/>
    <mx:DataGridColumn dataField="lastName" headerText="Last
    Name"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

    Ken, thank you for replying, I have had absolutly nothing but
    problems trying to get this 'simple' thing to work.
    Here is my code.
    In the remote-config.xml file, I have this code:
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="remoting-service"
    class="flex.messaging.services.RemotingService"
    messageTypes="flex.messaging.messages.RemotingMessage">
    <adapters>
    <adapter-definition id="java-object"
    class="flex.messaging.services.remoting.adapters.JavaAdapter"
    default="true"/>
    </adapters>
    <default-channels>
    <channel ref="my-amf"/>
    </default-channels>
    <destination id="SimpleJava">
    <properties>
    <source>javaSamples.SimpleMath</source>
    </properties>
    </destination>
    </service>
    Here is my MXML file: (Called new.MXML)
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:RemoteObject id="math" destination="SimpleJava">
    <mx:method name="doMath" concurrency="last"
    result="fillTxt(event.result as int)"/>
    </mx:RemoteObject>
    <mx:Script>
    <![CDATA[
    import mx.rpc.events.ResultEvent
    private function fillTxt(b: int):void{
    txtResult.text = (String)
    //comment
    ]]>
    </mx:Script>
    <mx:Panel x="10" y="24" width="250" height="200"
    layout="absolute" title="Simple Math with Java">
    <mx:Label x="10" y="10" text="Input Number to
    Multiply:"/>
    <mx:TextInput x="10" y="36" id="txtNumber"
    maxChars="1"/>
    <mx:Label x="10" y="126" id="txtResult"/>
    <mx:Label x="10" y="100" text="Your Number will appear
    below:"/>
    <mx:Button x="10" y="66" label="Multiply by 2"
    click="math.doMath(txtNumber.text)"/>
    </mx:Panel>
    </mx:Application>
    Here is my SimpleJava.java file:
    package javaSamples;
    //import java.util.*;
    * @author jsanders
    public class SimpleMath {
    public int doMath(String a){
    int new_a = Integer.parseInt(a.trim());
    int b = new_a * 2;
    return b;
    //changesd
    Like I said I have had absolutly nothing but problems with
    this. Yesterday, I was getting send failures, So I did some
    reasearch found some folks who said that they had the same problem,
    and they had to hard code the app name into the services-config.xml
    file. The file used to have {context.root} in it, and that variable
    was set to /flex, now I hardcoded this line into the my-amf channel
    definition to get rid of the send failure error.
    <channel-definition id="my-amf"
    class="mx.messaging.channels.AMFChannel">
    <endpoint uri="
    http://{server.name}:{server.port}/flex/messagebroker/amf"
    class="flex.messaging.endpoints.AMFEndpoint"/>
    <properties>
    <polling-enabled>false</polling-enabled>
    </properties>
    </channel-definition>
    As you can see what should say:
    http://{server.name}:{server.port}/{context.root}
    Now says:
    http://{server.name}:{server.port}/flex.
    This was the only way I could get the send error to go away.
    Now I worry that I might have broken something else. Since I
    removed all references to {context.root} in that file.
    {context.root} is defined in the flex-config.xml file, like
    this:
    <context-root>/flex</context-root>
    I have tried it with or without the '/' in the value of the
    context.root variable.
    I have played with the remoting-config file, and I know that
    I am accessing the destination.
    I have played with the <source> option of the
    destination, and I know that I am finding the class and making a
    good connection.
    I am using the JRUN install of FDS on my box, and yesterday
    at the end of the day after getting the context.root situation
    sorted out, I got a different error something like major.minor
    versioning errors.
    So the Java guys here at work told me that the JRUN version
    packaged with FDS was 1.4, and I used 1.5 to compile my java class.
    So I recompiled this morning with the 1.4 sdk. Now I dont get that
    error about the major minor versioning anymore.
    Now I get nothing. I use firefox, and all the browser tells
    me is 'transferring data from localhost' Nothing else. It just sits
    there and does nothing.
    When I did the debug on it, I got into a loop on the
    UIComponent.as file in the callLaterDispatcher(event:Event)
    function.
    Any clues what might be causing this new hang up. Basically
    the machine just hangs. Is there a problem with the result from the
    Method I am calling in the MXML? Did I do something wrong with the
    Event as Int thing?
    Again any help would be appreciated.

  • Cannot import java.util.concurrent.locks ... WHY?

    Why is Xcode unable to find the java.util.concurrent.locks package. The class browser knows it exists. For example the entry for the ReentrantLock class looks like this in the browser class window:
    ReentrantLock (java.util.concurrent.locks)
    Xcode knows about other java.util packages such as java.util.ResourceBundle which I have been accessed successfully in other parts of my projecgt.
    Here is a source file and the resulting compiler error:
    The source file:
    // Foo.java
    import java.util.ResourceBundle;
    import java.util.concurrent.locks;
    public class Foo { }
    The compiler error:
    compile:
    Compiling 2 source files to /Users/Terry/Desktop/JAVA/PROJECTS/Logic/bin
    /Users/Terry/Desktop/JAVA/PROJECTS/Logic/src/Foo.java:3: cannot find symbol
    symbol : class locks
    location: package java.util.concurrent
    import java.util.concurrent.locks;
    ^
    1 error
    BUILD FAILED
    Help or hints would be greatly appreciated!

    Well the reason to your problem is very simple... java.util.concurrent.locks is a package... Not a class.
    if you want to import a specific class, the class should be written at the end like you did for import java.util.ResourceBundle; but if you want to import a whole package you need to add the little star at the end :
    import java.util.concurrent.locks.*;
    Or else, you only import the class you need :
    import java.util.concurrent.locks.ReentrantLock;

  • Cannot import Java classes to form

    I am using Forms Forms [32 Bit] Version 10.1.2.0.2 (Production).
    I want to use the Persian Calendar from this web-site http://persiancalendar.sourceforge.net/.
    I download the stuff and there are 2 JAR files.
    I did this:
    -- Put the JAR files in my E:\Ora_Dev_10g_R2\forms\java directory
    -- Made an entry of these 2 in the E:\Ora_Dev_10g_R2\forms\server\formsweb.cfg file
    Now, when I open a form and got IMPORT JAVA CLASSES, I Can't see the classes.
    The directory structure of the 2 JAR files (after expanding is like this):
    persiancalendar.jar
    -> E:\Ora_Dev_10g_R2\forms\java\persiancalendar\com\ghasemkiani\util
    -> under util there is the sub-dir icu
    icu4j_3_2_calendar.jar
    -> E:\Ora_Dev_10g_R2\forms\java\icu4j_3_2_calendar\com\ibm\icu
    -> under icu there are these sub-directories impl, lang, math, text, util
    The E:\Ora_Dev_10g_R2\forms\java is in my CLASSPATH:
    C:\>echo %CLASSPATH%
    .;e:\Ora_Dev_10g_R2;*e:\Ora_Dev_10g_R2\forms\java*;D:\Program Files\QuickTime\QTSy
    stem\QTJava.zip;

    Scott,
    I agree with Abdetu, you should create your own thread for your question. However, to set an environment variable in UNIX you declare the variable and then export it. For example, in your default profile you could add the following:
    FORMS_BUILDER_CLASSPATH='Your Path Here'
    export FORMS_BUILDER_CLASSPATHCraig...
    Edited by: CraigB on Feb 4, 2011 11:24 AM

  • Importing java class in servlet

    hi,
    i need to import a java class file in a servlet. how do i do that.
    also, when i remove the following lines, the import & the line following line,
    //JavaClass class=new JavaClass();
    msgsend class=new msgsend();
    it compiles ok, else i get the error,
    out.println cannot resolve symbol.
    the code of the servlet is as follows:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.servlet.http.HttpSession;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletContext;
    import javax.servlet.ServletException;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    import "msgsend.class";
    * @author A
    * @version
    public class myemail2 extends HttpServlet {
    String to,bcc,cc,from,subject;
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, java.io.IOException {
    HttpSession session = request.getSession();//geting a new session everytime this is called
    PrintWriter out = response.getWriter();
    try
    System.out.println(1);
    response.setContentType("text/html");
    out.println("<html>");
    out.println("<head>");
    out.println("<title> </title>");
    out.println("</head>");
    to=request.getParameter("to");
    from=request.getParameter("from");
    bcc=request.getParameter("bcc");
    cc=request.getParameter("cc");
    subject=request.getParameter("subject");
    System.out.println(to);
    //JavaClass class=new JavaClass();
    msgsend class=new msgsend();
    System.out.println(2);
    out.println("<body align= center bgcolor='white'>");
    out.println("<br><br><br><br><H2 align=center> ");
    out.println("<FONT color=#ffffff face=arial size=2></FONT>");
    out.println("</FORM>");
    out.println("</B><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><pagebreak>");
    out.println("<footer align=center><font size=1><a href='/wpc.html'>");
    out.println("Home Page");
    out.println("</a></footer>");
    //place javascript function for exiting window
    out.println("</form>");
    out.println("</body>");
    out.println("</html>");
    } catch(Exception e){ }
    out.close();}
    pls help,
    thanx,
    ashna

    You have to do like the others import. You have to put import and the complete path(with all the packages).
    For example:
    import mypackage.msgsend;
    and if you wouls like to import all the classes of a package use:
    import mypackage.*;

  • Exception in thread "main" java.sql.SQLException: ORA-00604

    Just tried to compile the code "Example 2-1 Determing the JDBC Driver Version" from "2day plus Java Developoer Guide"..
    import java.sql.*;
    import oracle.jdbc.*;
    import oracle.jdbc.pool.OracleDataSource;
    public class JDBCVersion
    public static void main (String args[]) throws SQLException
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:hr/hr@localhost:1521/XE");
    Connection conn = ods.getConnection();
    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();
    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
    So, when I have to execute this programm:
    Exception in thread "main" java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
    ORA-12705: Cannot access NLS data files or invalid environment specified
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
    at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:785)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
    at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:297)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:221)
    at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:165)
    at oracle.JDBCVersion.main(JDBCVersion.java:12)
    Pls, help me w/that. TNX.

    Hi,
    I remember it also doesn't work for me. Try this:
    DriverManager.getConnection("jdbc:oracle:thin:@<mc-name>:<port-no>:<sid>", "scott", "tiger");
    Kuba

  • When included  import java.util.* then why include import java.util.Gregori

    Hi,
    In my program I hava inported the java package like
    import java.util.*;
    import java.sql.*;
    import java.text.*;
    then for using some classes like Gregorial calender,Date etc,I have to again import
    import java.util.Date;
    import java.sql.PreparedStatement;
    import java.util.GregorianCalendar;
    As far as I know if I have import the above like
    import java.util.*; then it means I can use any classes in java.util ,but if I am not importing
    import java.util.GregorianCalendar;
    import java.util.Date;
    my program is giving error.Can somebody tell me,where my concept is wrong.
    Thanks

    import java.sql.*;
    import java.util.*;
    //import java.util.Date;  // <-- needed to avoid "the type Date is ambiguous"
    public class PackageEg {
        public static void main(String[] args) {
            Date test = new Date();
    }This code gives an error when I compile it, but if I include the
    java.util.Date import it is good. The reason is that there are two
    possible Date classes - one in java.util and one in java.sql. The
    compiler cannot figure out which one I mean.
    If I include a specific class like java.util.Date, then this one will be used
    in preference to any .* imports. (These are called "imports on demand")
    This explains why you need java.util.Date, but the other two are a
    mystery. As far as I know PreparedStatement and GregorianCalander
    are unique names within the packages you mention. Could you post
    some code that will not compile unless the specific import statements
    are there?

  • Catching jsp/tomcat/java SQL error

    I have been trying to get the sample code to work from an old book. I was finally able to get it to run under tomcat 4.1.31 but there is one bug I just cannot figure out how to handle. I am a beginner to Java/JSP/Tomcat and have about 16+ hours invested in this problem so far.
    The delFruit.jsp calls methods from FruitConnect.java.
    I found that if the fruit chosen for deletion was not involved in a referential integrity link to a FruitMonth file the code works fine. But if it is linked the delFruit.jsp just displays a blank screen and nothing is deleted. It is fine for it not to be deleted but I cannot find anyway to handle it. I tried to add the checkFruitForSale bandaid below but it causes me a blank screen as well.
    Any help would be appreciated.
    It would be great if I could just see what is happening when FruitConnect is processing code. I get no errors, just a blank screen. I'm going to try using NetBeans and their debugger next.
    Here is delFruit:
    <%@ page import="java.sql.*" %>
    <jsp:include page="adminHeader.html" flush="true" />
    <jsp:useBean id="fruitConnect" class="fruit1.FruitConnect" />
    <%
    String msg = "The following fruits have been deleted:<br> ";
    //Build the list of fruits to delete
    String delFruit[] = request.getParameterValues("delFruit");
    //WE WILL ONLY GET CHECKBOXES THAT WERE CHECKED
       String fruitList = "";
       if (delFruit != null){
         int len = delFruit.length;
         fruitConnect.dbConnect();
         for (int i = 0; i < len; i++) {
              String passfruit = delFruit;
              if (fruitConnect.checkFruitForSale(passfruit)) {}
              else{
              fruitList = fruitList + "'" + delFruit[i] + "',";
              msg = msg + delFruit[i] + "<br>";
              out.print(msg);
              out.print(msg);
         fruitList = fruitList + "'nonsense'";
         if (fruitConnect.deleteFruit(fruitList) < 1) {
              msg = "There was an error deleting the fruits from the database.";
         else{
         msg = "Deletion was successful";
         fruitConnect.dbDisconnect();
    else {
         msg = "You must select some fruit to delete.";
    %>
    HERE IS FruitConnect.java
    package fruit1;
    import java.sql.*;
    public class FruitConnect {
       private Driver drv = null;
       private Connection conn = null;
       private ResultSet rs = null;
       private Statement stmt = null;
       public FruitConnect(){}
       public void dbConnect() throws Exception{
    //      drv = (Driver) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    //      conn = DriverManager.getConnection("jdbc:odbc:Fruit");
    try{
          drv = (Driver) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
          conn = DriverManager.getConnection("jdbc:odbc:Fruit");
    catch ( SQLException sqlException)
    sqlException.printStackTrace();
    finally
    try{
    catch (Exception exception)
       public boolean getNextItem() throws Exception{
          boolean ret = rs.next();
          return(ret);
       public String getItemNameString(String columnName) throws Exception{
          String name = rs.getString(columnName);
          return(name);
       public float getItemNameFloat(String columnName) throws Exception{
          float name = rs.getFloat(columnName);
          return(name);
       public boolean selectFruits() throws Exception{
          String query = "SELECT Id, Name FROM Fruit";
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public boolean selectMonths() throws Exception{
          String query = "SELECT Id, Name FROM Month";
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public boolean selectFruitForSale() throws Exception{
          String query = "SELECT F.Name AS Fruit, M.Name AS Month, Price, Weight, (Price * Weight) AS TotalPrice FROM FruitMonth AS FM, Fruit AS F, Month AS M WHERE FM.FruitId = F.Id AND FM.MonthId = M.Id ORDER BY M.Id";
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public int insertFruit(String name) throws Exception{
          String query = "INSERT INTO Fruit (Name) VALUES ('" + name + "')";
          stmt = conn.createStatement();
          int ret = stmt.executeUpdate(query);
          return(ret);
       public int insertFruitForSale(String insertValues) throws Exception{
          String query = "INSERT INTO FruitMonth (FruitId, MonthId, Price, Weight) VALUES (" + insertValues + ")";
          stmt = conn.createStatement();
          int ret = stmt.executeUpdate(query);
          return(ret);     
       public int deleteFruit(String fruitList) throws Exception{
          String query = "DELETE FROM Fruit WHERE Name IN (" + fruitList + ")";
          stmt = conn.createStatement();
          int ret = stmt.executeUpdate(query);
          return(ret);
       public void dbDisconnect() throws Exception{
          stmt.close();
          conn.close();
       public boolean checkFruitForSale(String thisfruit) throws Exception{
          String query = "SELECT F.Name AS Fruit, M.Name AS Month, Price, Weight, (Price * Weight) AS TotalPrice FROM FruitMonth AS FM, Fruit AS F, Month AS M WHERE FM.FruitId = F.Id AND FM.MonthId = M.Id AND F.Name IN (" + thisfruit + ") ORDER BY M.Id";
    try{
          stmt = conn.createStatement();
          rs = stmt.executeQuery(query);
    catch ( SQLException sqlException)
    sqlException.printStackTrace();
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
    finally
    try{
    catch (Exception exception)
          boolean ret = false;
          if (rs != null)
             ret = true;
          return(ret);
       public String Check1(String columnName) throws Exception{
          String name = rs.getString(columnName);
          return(name);

    First thing to check would be the Tomcat log file. Most likely there is an error message printed there:
    Look in [TOMCAT]/logs for any files modified recently. Open it, and you should find some hints as to your error.
    It would be great if I could just see what is happening when
    FruitConnect is processing code.For that sort of thing, you want to use a logger. Either Log4J or the standard Java1.4 logger would help. Basically configure it to log statements to file as your program runs.
    I get no errors, just a blank screenThat could indicate that the page ran enough to fill up the page buffer, and then failed. When you view source, do you see anything on the page at all?

  • Conversions between java.util.Date, java.util.Timestamp and java.sql dates

    I am coding a hoilday booking system using JSP to interact with a SQL Server database. On my JSP form which retrieves the information I have a little javascript pop-up date selector which appears to be returning a Timestamp value although the string value is visable in the entry field. Can I pass this to a javabean as a Timestamp, so far I have only passed strings? Also I then have to enter it in the database and so will need to convert it to an sql date type but I dont know which one is best. Previous to using the Timestamp returning calendar I was just entering text and parsing it to a util.Date in the bean and then converting that to an sql.Date for entry in the database. That worked fine but I want to use the pop-up any ideas? Also my bean won't compile if I declare java.util.Timestamp t;(cannot resolve symbol Timestamp !) even though I have imported util.

    First of all, java.util.Timestamp does not exist. You probably need java.sql.Timestamp.
    java.sql.Date and java.sql.Timestamp inherit from java.util.Date. So converting from java.sql.Date or java.sql.Timestamp to java.util.Date is easy, you don't have to do anything.
    To convert a java.util.Date to a java.sql.Timestamp, do something like this:
    import java.sql.Timestamp;
    import java.util.Date;
    Date date = new Date();
    Timestamp ts = new Timestamp(date.getTime());Jesper

  • Error...java.sql.SQLException:Access denied for user

    Hi,
    I am getting the following error message while connecting with the MySQL .(O/S :Sun OS 5.6)
    Error.....java.sql.SQLException: Invalid authorization specification: Access denied for user: 'some_user&password@localhost' (Using password: NO)
    Note that i have given all permission to the user using,
    GRANT ALL PRIVILEGES .......................
    The code i have used to connect with the database is,
    import java.io.*;
    import java.sql.*;
    class test
    public static void main(String a[])
    try
    Connection con;
    Statement stmt;
    ResultSet rs;
    Class.forName("org.gjt.mm.mysql.Driver");
    con=DriverManager.getConnection(jdbc:mysql://localhost/db_name?user=some_user&password=some_pass");
    stmt=con.createStatement();
    //do something with resultset
    catch(Exception e)
    System.out.println("Exception in second try.."+e);
    plese guide me on this problem to solve.
    Thankz,
    Bala.

    Hi friends...
    I've read the last post...
    The problem that I have is as follow....
    1. I have installed on my machine MySQL 5.0 Server running
    1.1 I have a database called "base1"
    1.2 User "root", password "works"
    1.3 I have the following sentence to connect it using JDBC
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost/base1", "root", "works");
    More notes:
    - I use the JDBC 5.0
    - My Machine is a Windows XP SP2 Pentium 3.0 512Mb
    and it connects����
    but I have this environment to develop applications, now that I want to connect to Production Environment happens the following:
    2 The Production database is mounted on a Linux Server with MySQL 3.2.
    2.1 I change the sentences as follow:
    Connection con = DriverManager.getConnection("jdbc:mysql://192.168.0.7/base1", "user", "password");
    2.3 But a message appears when I run the Java Program:
    java.sql.SQLException:Access denied for user: '[email protected]' (Using password: YES)
    2.4 As you can see it changes the IP Address...
    More notes:- I have the MySQL Query Browser and I got connection.
    - The IP that display the Error Message is my Second IP configurated on my Network Properties.
    - Server is a Pentium 4 3.0 GHz 2Gb Linux Red Hat 3.0
    I leave this case for the spider... I hope that somebady has the solution.
    What is the problem? Why the JDBC doesn't respect the IP that I wrote.

Maybe you are looking for

  • Adobe Design Std CS6 6.0 WIN ESD LRE

    We have purchsed Adobe Design Std CS6 6.0 WIN ESD LRE  and after installation adobe acrobat pro often gets crashed which need to be re-installed

  • Something is wrong with my billing

    i can't get to my itunes store to update and my apps aren't working

  • Moving Composition from one project to another?

    Hi Is there any way to move a Composition from Project A into Project B with all it's layers,Keyframes etc...? I'm using AE CS3 ... never had to do it before ... but never say never hey? Thanks for the help Lee

  • Dynamic navigation in captivate 4

    My problem seems simple enough, so I'm feeling pretty dumb right about now: I would like to use Captivate 4 to publish a book in swf. Every page of the book should have a text input field and submit button. The user inputs the page (slide) he wants t

  • CO-PA requirement gathering

    Hi, We are in planning to implement CO-PA for our client. We are not sure what we need to collecte business requirements from the client at this level. They have SD, MM and PP modules together. Could any one one please help this requirement gathering