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.

Similar Messages

  • 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

  • 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

  • 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

  • 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.

  • 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.

  • Java.sql.SQLException: Error in allocating a connection

    hi,
    I have developed enterprise application using net beans IDE 5.5.I created one enity bean using sql server database.When i tried deploy this project i am getting following error...
    Internal Exception: java.sql.SQLException: Error in allocating a connection.
    Cause: Class name is wrong or classpath is not set for : com.microsoft.jdbc.sqlserver.SQLServerDataSourceError
    can anybody please help me.....where i went wrong...i am new to netbeans IDE
    regrds
    patel

    u need to download the three jar files.
    download the following jar files and add in ur classpath.
    msutil-2000.sp2-lib.jar
    msbase-2000.sp2-lib.jar
    mssqlserver-2000.sp2-lib.jar
    This is sample program...
    u can test in standalone first and do in netbeans....
    import java.sql.*;
    public class querybean {
    public String getdata(String sql) {
         try {
    System.out.println("testing connection ");
              Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
         Connection connection = DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=master;user=sa;password=userpass;");
         Statement statement = connection.createStatement();
    ResultSet rs = statement.executeQuery(sql);
    System.out.println("testing connection pooling");
    while(rs.next()) {
    System.out.println(rs.getString(1));
    } catch(Exception e1) {
    System.out.println("exception caught" + e1);
    return "";
    public static void main (String args[]) throws Exception {
    querybean qb = new querybean();
    qb.getdata("select * from sampletable");
    I belive it will work now

  • I am getting Error! java.sql.SQLException:General error

    hi every body,
    I struck with this error , can any one suggest in solving this.
    I had a table in oracledatabase ,i have successfully created a table and inserted clob column with an attachment like xxx.txt.
    table format----> id and text columns
    Now my question is to retrieve that data and store it in local disk i am getting this error
    import java.io.*;
    import java.sql.*;
    //import java.sql.SQLException;
    public class Cread {
    public static void main(String[] args) throws ClassNotFoundException,IOException,SQLException {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection cn=DriverManager.getConnection("jdbc:odbc:sivadsn","scott","tiger");
    Statement s = cn.createStatement();
    ResultSet rs=s.executeQuery("Select text from ram where id=10");
    if(rs.next()){
    FileOutputStream file=new FileOutputStream("c:/store.txt");
    InputStream fin=rs.getBinaryStream(1);
    int c;
    while((c=fin.read())!=-1){
    file.write(c);
    fin.close();
    s.close();
    rs.close();
    catch(IOException e){
    e.printStackTrace();
    System.out.println("Err:"+e);
    I am getting the error as
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)Error! java.sql.SQLException: General error
    at attach.Clobread.main(Clobread.java:30)

    That usually means something is wrong with the syntax of your sql.
    As a guess 'text' is probably a keyword and shouldn't be used as a field name. It is possible that the same is true for 'id'

  • Error: java.sql.SQLException: ResultSet is closed

    Hi,
    Can anyone help me figure out why I am getting this error for the program below.
    All that I am trying to do is,
    retrieve the " patchid, email_sent, AM_updated, admin_pqr_created " fields from a previous page and update my incompleteTasks table with that information. When I run this program my table is getting update with the information in these strings but I am getting this error.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.text.DateFormat;
    public class incompleteTasksupdate extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException
    try
         // create an object for class that returns Connection string
         SqlServerConnection sqlconn = new SqlServerConnection();
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String patchid = null;
    String email_sent = null;
    String AM_updated = null;
    String admin_pqr_created = null;
    String patchid_indatabase = null;
    String username_indatabase = null;
    String emailsent_indatabase = null;
    String AM_updated_indatabase = null;
    String AdminPQR_indatabase = null;
    // Session to maintain the username
    HttpSession session = request.getSession(true);
    String username = null;
    username = ((String)session.getAttribute("UserName")).trim();
    patchid = (request.getParameter("PatchID")).trim();
    email_sent = (request.getParameter("Emailsent")).trim();
    AM_updated = (request.getParameter("AMUpdated")).trim();
    admin_pqr_created = (request.getParameter("AdminPQR")).trim();
    String main_menu = "/PatchTool/process.jsp ";
    String incomplete_task = "/PatchTool/incompletetask.jsp";
    // String patchid_limitexceed = "/PatchTool/PatchidExceed.jsp ";
    boolean row_updated = false;
    // Driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    // Connect to db
    String dbinfo = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:/Program Files/PatchTool/patchtool.mdb";
    Connection conn = DriverManager.getConnection(dbinfo); */
         // get connection string from object
         Connection conn = sqlconn.getSqlConnectionString();
    // create statement
    Statement stmt = conn.createStatement();
    // string to hold SQL Query
    // String sql = null;
    String update_table = null;
    // Get results by executing query on DB
    ResultSet RS = stmt.executeQuery(" SELECT * FROM IncompleteTasks");
    // If Result Set has rows returned; hence not null
    if (RS != null)
         while(RS.next())
    username_indatabase = (RS.getString("userName")).trim();
    patchid_indatabase = (RS.getString("PatchId")).trim();
    if(username.compareTo(username_indatabase) == 0)
         if(patchid.compareTo(patchid_indatabase) == 0)
              int string_update_value = 999;
    update_table = "Update IncompleteTasks SET emailSent = '" email_sent"', " +
              " AMUpdated = '" AM_updated"', adminPQR = ' " admin_pqr_created"' " +
              " WHERE userName = '" username "' AND patchId = '" + patchid +"' ";
    stmt.executeUpdate(update_table);
              row_updated = true;
    } // RS.next
    } // RS.null
         // Assign the User Name to a session variable.
         session.setAttribute("UserName", username);
         // Dispose resources
    RS.close();
    stmt.close();
    conn.close();
         if(row_updated)
    response.sendRedirect(main_menu);
    else
    response.sendRedirect(incomplete_task);
         catch     (SQLException e)
         response.setContentType("text/html");
         PrintWriter out = response.getWriter();
         out.println("Error retrieving/updating data from table: "+e);
         catch(Exception e)
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("Error: "+e);
    public void doPost(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException
    doGet(request, response);
    Thanks!
    bobby.

    Create a different statement to run the update statement in your loop.
    Using the same statement as your result set was generated from will create this error.
    Statement stmt = conn.createStatement();
    Statement stmt2 = conn.createStatement();
    ResultSet RS = stmt.executeQuery(" SELECT * FROM IncompleteTasks");
    while(RS.next(){
      stmt2.executeUpdate(update_table);
    }

  • Java.sql.SQLException: Io exception: End of TNS data channel

    Hello folks,
    Has amyone encountered this exception? If so, could you please shed some light for what might be going wrong?
    Here is my confuguration:
    400MB RAM
    1.2GHTz processor
    Win2K Pro
    Oracle server 9.0.1
    JDBC Thin driver (libs for 9.0.1)
    Scenario:
    My Java code uses Oracle Spatial to insert SDO_GEOMETRY objects into my DB model.
    I have a config file where I store my connection properties, e.g.,
    <DBConnection name="twatest">
    <JDBCDriver>oracle.jdbc.driver.OracleDriver</JDBCDriver>
    <URL>jdbc:oracle:thin:@saturn:1521:saturn</URL>
    <Username>user1</Username>
    <Password>twatest</Password>
    </DBConnection>
    We have 2 schemas defined: user1 and twatest.
    The problem first occured when I switched from user1 to twatest. Consequent attempt to run the process as user user1 failed! The Java SQL statements do not use schemas (so they default, I suppose, to the default schema for that particular user, in our case being user1-->user1, twatest-->twatest).
    The problem happens in the following Java class (search for "HERE" to see where exactly the problem occurs):
    package com.vividsolutions.twatest;
    import java.util.*;
    import java.sql.*;
    import oracle.sql.*;
    import oracle.sdoapi.OraSpatialManager;
    import oracle.sdoapi.geom.*;
    import oracle.sdoapi.adapter.*;
    import oracle.sdoapi.sref.*;
    import com.vividsolutions.twatest.parser.*;
    import com.vividsolutions.twatest.config.*;
    import com.vividsolutions.twatest.model.*;
    * This class is responsible for loading lakes into the SDO Oracle Spatial DB.
    public class LakeLoader
    static boolean initialized = false;
    private static GeometryFactory gF;
    private static SRManager srManager;
    private static SpatialReference sref;
    private static GeometryAdapter sdoAdapter;
    public static void loadLake(EdgedLake slake, Connection conn) throws Exception {
    com.vividsolutions.jts.geom.Envelope e = slake.getEnvelope();
    if (e == null) {
    System.out.println("Invalid envilope (feature ID="+slake.getFeatureId()+")! Ignoring...");
    return; // ignore lake - it's invalid (no envilope)
    if (!initialized) {
    initialize(conn);
    initialized = true;
    Geometry geom;
    STRUCT str;
    // insert Lake
    String lakeQuery = "INSERT INTO lake " +
    "(lake_id, area, bounding_box, name, instantiation_date) " +
    "VALUES(?,?,?,?,?)";
    PreparedStatement ps = conn.prepareStatement(lakeQuery);
    int lakeId = getId(Lake.ID, conn);
    ps.setInt(1, lakeId);
    ps.setDouble(2, Double.parseDouble(slake.getArea()));
    // Creates a 2-D rectangle (special case of Polygon geometry).
    geom = gF.createRectangle(e.getMinX(), e.getMinY(), e.getMaxX(), e.getMaxY());
    ps.setObject(3, sdoAdapter.exportGeometry(STRUCT.class, geom));
    ps.setString(4, slake.getName());
    ps.setTimestamp(5, new Timestamp(new java.util.Date().getTime()));
    ps.executeUpdate(); // <-- HERE I got: java.sql.SQLException: Io exception: End of TNS data channel
    //ps.close();
    String ringQuery = null;
    int ringId = 0;
    List shellEdges = slake.getShellEdges();
    if (shellEdges != null && shellEdges.size() > 0) { // if there is valid shell, insert it...
    // insert shell Rings
    ringQuery = "INSERT INTO ring (ring_id, lake_id, type) VALUES(?,?,?)";
    ps = conn.prepareStatement(ringQuery);
    ringId = getId(Ring.ID, conn);
    ps.setInt(1, ringId);
    ps.setInt(2, lakeId);
    ps.setString(3, Ring.SHELL);
    ps.executeUpdate();
    //ps.close();
    // insert shell ring Edges
    insertEdges(shellEdges, lakeId, Ring.SHELL, ringId, conn);
    List holeEdges = slake.getHoleEdges();
    if (holeEdges != null && holeEdges.size() > 0) { // if there are valid holes, insert them...
    // insert hole Rings
    ringQuery = "INSERT INTO ring (ring_id, lake_id, type) VALUES(?,?,?)";
    ps = conn.prepareStatement(ringQuery);
    ringId = getId(Ring.ID, conn);
    ps.setInt(1, ringId);
    ps.setInt(2, lakeId);
    ps.setString(3, Ring.HOLE);
    ps.executeUpdate();
    //ps.close();
    // insert hole ring Edges
    insertEdges(holeEdges, lakeId, Ring.HOLE, ringId, conn);
    ps.close();
    private static void insertEdges(List edges, int lakeId, String ringType,
    int ringId, Connection conn) throws Exception {
    if (!initialized) {
    initialize(conn);
    initialized = true;
    Geometry geom;
    STRUCT str;
    // insert shell ring Edges
    String edgeQuery = "INSERT INTO edge " +
    "(edge_id, lake_id, ring_type, ring_id, edge_sequence, shape) " +
    "VALUES(?,?,?,?,?,?)";
    int edge_sequence = 0;
    for (Iterator it=edges.iterator(); it.hasNext(); ) {
    Edge edge = (Edge)it.next();
    geom = gF.createLineString(LakeFactory.edgeToArray2D(edge)); // 2-dimensional coordinates
    PreparedStatement ps = conn.prepareStatement(edgeQuery);
    int edgeId = getId(Edge.ID, conn);
    ps.setInt(1, edgeId);
    ps.setInt(2, lakeId);
    ps.setString(3, ringType);
    ps.setInt(4, ringId);
    ps.setInt(5, edge_sequence++);
    ps.setObject(6, sdoAdapter.exportGeometry(STRUCT.class, geom));
    ps.executeUpdate();
    ps.close();
    * @param key This can be: "lake", "ring", or "edge".
    * @param conn The connection to use.
    * @return the unique ID corresponding to the given key.
    public static int getId(String key, Connection conn) {
    int id = -1;
    try {
    String query = "SELECT "+key+"_SEQUENCE.NEXTVAL FROM DUAL";
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(query);
    while (rs.next()) {
    id = rs.getInt(1);
    stmt.close();
    } catch(SQLException sqle) {
    sqle.printStackTrace();
    return id;
    private static void initialize(Connection conn) throws Exception {
    gF = OraSpatialManager.getGeometryFactory();
    // Set spatial reference system in which the geometries will be created
    srManager = OraSpatialManager.getSpatialReferenceManager(conn);
    sref = srManager.retrieve(8307);
    gF.setSpatialReference(sref);
    sdoAdapter = OraSpatialManager.getGeometryAdapter("SDO", "8.1.6",
    null, STRUCT.class, null, conn);
    public static void main(String args[]) throws Exception
    String[] xmlLakeFiles = {
    "lakes101to1400.xml",
    "lakes1401to10000.xml",
    "lakes10001to20000.xml",
    "lakes20001to30000.xml",
    "lakes30001to40000.xml",
    "lakes40001to50000.xml",
    "lakes50001to60000.xml"
    PropertyManager pm = new PropertyManager();
    int numberOfLoadedLakes = 0;
    try {
    pm.initialize();
    Map modelMap = (Map)pm.get(XMLConfigFile.MODEL_MAP);
    LakeModel lakeModel = (LakeModel)modelMap.get(LREConcreteLakeModel.NAME);
    Connection connection = ConnectionManager.getConnection();
    lakeModel.setConnection(connection);
    for (int i=0; i<xmlLakeFiles.length; i++) {
    long then = System.currentTimeMillis();
    System.out.println("Loading lake "+xmlLakeFiles[i]+"...");
    numberOfLoadedLakes = lakeModel.loadModel(xmlLakeFiles);
    long now = System.currentTimeMillis();
    System.out.println("Loaded "+numberOfLoadedLakes+" lakes!");
    System.out.println("Execution time: "+(now-then)/1000+" seconds!");
    System.out.println("Loading lake "+xmlLakeFiles[i]+"...done!");
    connection.close();
    } catch(Exception e) {
    e.printStackTrace();
    My client class calls LakeLoader.loadLake() method in a loop to load a bunch of Lake objects into the DB. The first lake in the list is created without problems, but when the 2-nd lake is being inserted, I get an exception at the preparedStatement.executeUpdate() statement. This happens consistently.
    I tried to find information on this on the net, but seems that this problem only happened when people dealt with LOBs?!
    Thank you very much!
    Georgi

    Suresh -- I'd probably log a TAR with Oracle support for this question if you definitely need it resolved. Support have access to all manner of existing cases, so this may be something they have seen before.
    cheers
    -steve-

  • How do I create a Dynamic java.sql.Date ArrayList or Collection?

    I Have a MySQL table with a Datetime field with many values inserted.
    I want to know which is the Best way to capture all the Inserted DB values inside a Dynamic Array.
    I get errors that state that I should use Matching data-types, and plus I don't know how to create or fill a Dynamic Date ArrayList/Collection.
    Please Help, I need this urgently...

    package pruebadedates;
    import java.sql.*;
    * @author J?s?
    public class ClaseDeDates {
        /** Creates a new instance of ClaseDeDates */
         * @param args the command line arguments
        public static void main(String[] args) {
            java.sql.Date aDate[] = null;       
            Connection con = null;
            Statement stmt = null;
            ResultSet rs = null;
            try{
                Class.forName("com.mysql.jdbc.Driver").newInstance();
                con = DriverManager.getConnection("jdbc:mysql://localhost/pruebafechas", "root", "picardias");
                    if(!con.isClosed()){
                    stmt = con.createStatement();
                    stmt.executeQuery ("SELECT dates FROM datestable");
                    rs = stmt.getResultSet();
                        while (rs.next())
                        aDate[] = rs.getDate("dates");
            catch(Exception e)
               System.out.println(e);
            //System.out.println(aDate);     
    }Hi, There is my code and the errors that I get are:
    found : java.sql.Date
    required: java.sql.Date[]
    aDate = rs.getDate("dates");
    Actually I have No idea as How to get a Result set into an ArrayList or Collection. Please tell me how to do this Dynamically. I have like 25 records in that Database table, but they will grow, so I would really appreciate to know the code to do this. I suspect my problem is in the bolded part of my code.
    Thank you very much Sir.

  • Tion in thread "main" java.sql.SQLException: Io exception: The Network Adap

    I know this has been posted repeatedly. However, I have tried all the generic solutions Mine is a little different.
    1. I can connect with SQLPLUS to the database. I am on windows XP connecting to Oracle 10g on a Solaris box. So the listener is running.
    2. Here is my tnsnames.ora entry which works with SQLPLUS:
    I can tnsping this address
    SID_NAME =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = IP_NUMBER)(PORT = 1521))
        (CONNECT_DATA =
          (SERVICE_NAME = SID_NAME)
      )I am trying to run the following sample code:
    * This sample shows how to list all the names from the EMP table
    * It uses the JDBC THIN driver.  See the same program in the
    * oci8 samples directory to see how to use the other drivers.
    package basic;
    // You need to import the java.sql package to use JDBC
    import java.sql.*;
    class Employee
      public static void main (String args [])
           throws SQLException
        // Load the Oracle JDBC driver
        DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
        // Connect to the database
        // You must put a database name after the @ sign in the connection URL.
        // You can use either the fully specified SQL*net syntax or a short cut
        // syntax as <host>:<port>:<sid>.  The example uses the short cut syntax.
        String url = "jdbc:oracle:thin:@IP_NAME:1521:SID_NAME";
        String userName = "USERNAME";
        String password = "PASSWORD";
        if (args.length > 0) url = args[0];
        if (args.length > 1) userName = args[1];
        if (args.length > 2) password = args[2];
        //Connection conn =
        //  DriverManager.getConnection (url, userName, password);
    Connection conn =
        DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=IP_NUMBER:1521)(PORT=1521)))(CONNECT_DATA=(SID=SID_NAME)(SERVER=DEDICATED)))", "USERNAME", "PASSWORD");
        // Create a Statement
        Statement stmt = conn.createStatement ();
        // Select the ENAME column from the EMP table
        ResultSet rset = stmt.executeQuery ("select object_name from user_objects");
        // Iterate through the result and print the employee names
        while (rset.next ())
          System.out.println (rset.getString (1));
    }I also used the following IP
    Connection conn =
          DriverManager.getConnection (url, userName, password);

    Replace the url with
    String url = "jdbc:oracle:thin:@IP_NUMBER:1521:SID_NAME";

  • 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.*;

  • ADF Bc third party JDBC Driver java.sql.SQLException: No suitable driver

    Hello all
    I am using JT400.jar file to connect to AS/400 data base in my JSF/ADF Application.
    We are using shared library for all non oracle jar files . and my application fails with error message
    ## Detail 0 ##
    java.sql.SQLException: No suitable driver
    During runtime. even though i am importing the required jar files from shared library settings in server.xml / application.xml
    When i don't have the entry in shared library for this jar file it will fail during deployment time it self, but with shared library link it works during deployment but fails during runtime
    it will work during runtime if i add my jar file to BC4J/lib folder. but team responsible for mintaining application server don't accept adding non oracle jar files to oracle installation folders
    i have also posted this in jdev forum
    Please Advise
    Thanks

    Thanks for reply
    i am using Sqlserver 2000 as back end
    import java.sql.*;
    import java.net.*;
    public class MysqlConnect{
         public static void main(String[] args) {
              System.out.println("MySQL Connect Example.");
              Connection conn = null;
    // String url = "jdbc:mysql:/localhost:3306/";
    String url = "jdbc:microsoft:sqlserver/GTEXC/";
    String dbName = "java";
    // String driver = "Sun.Jdbc.Odbc.JdbcOdbcdriver";
    String userName = "root";
              String password = "root";
              try {
    Driver d=(Driver)Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
                   conn = DriverManager.getConnection(url+dbName,userName,password);
                   System.out.println("Connected to the database");
                   conn.close();
                   System.out.println("Disconnected from database");
              } catch (Exception e) {
                   e.printStackTrace();
    }

Maybe you are looking for

  • How can i fix my iphone 3gs when i have network issues after updating to IOS 6.1.3 and avoid the connect to ITunes screen?

    Im an owner of an Iphone 3gs. When I updated my software to IOS 6.1.3 I started having network issues such as my phone would go on searching, it would search for signal and then No service after few minutes it would restart and when its on again it w

  • Open File in Acrobat or Reader

    I have Acrobat 8 and Reader X installed on my PC (Vista Business). After installing updates for both programs over the past few months I have lost the default toolbar on documents I download from the web and need to use F8 to get a toolbar. In additi

  • Solaris 10 Upgrade

    Hi, I am attempting to patch a system from Solaris 10: 11/06 to Solaris 10: 05/09. From what I can see, I can not do this using a 'patch bundle' as this does not give me new features (the purpose of the exercise is to get the new features). My compan

  • DPM 2012 R2 CU 4 - issue w/ system state backup completing on non domain servers with T2embed.dll

    I am really new to DPM and just took over a system that has servers being backed up that are not part of the domain. The volumes backup fine and system state will not complete. In looking at the protection group server the WindowsImageBackup folder i

  • Wifi won't work in the US

    I have a European iPhone 4. After landing in the US yesterday I haven't been able to connect to any wifi. What could be the problem here? I understand I can't make calls with my iphone in the US but surely wifi shouldn't be affected? Oh, and the same