Results 1 to 3 of 3
  1. #1
    JAVA0282 is offline Member
    Join Date
    Apr 2010
    Posts
    4
    Rep Power
    0

    Default Error While Assigning Value in Array from ms Access

    dear

    I have Created connection with ms access,but there is problem,while assigning value to array,& also getting error "RND.JAVA:59: CANNOT RESOLVE SYMBOL"

    please kindly help me on this regard.

    --Furqan

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    832
    Rep Power
    6

    Default

    Post the code with code tag.
    Ramya:cool:

  3. #3
    JAVA0282 is offline Member
    Join Date
    Apr 2010
    Posts
    4
    Rep Power
    0

    Default

    I have mentioned code below, there is connection for ms access to get date & need to assign in array for insertion in oracle, but after its successful compilation then i will make connection to insert data in oracle database by the array.

    I have added parameter for EMPNO but i need to add date parameter, actually I have to get data on the base of date parameter.

    So kindly please if it possible to add data parameter in query as well.

    Tanks for helping me


    ------------start
    /**
    * OdbcAccessConnection.java
    * Copyright (c) 2007 by Dr. Herong Yang. All rights reserved.
    */
    import java.sql.*;
    import java.sql.Connection;
    public class Rnd {

    static {
    char[] v_name = new char[30];
    int[] v_empno = new int[30];
    int b =1;

    }




    //Static String[] v_name = new String[30];
    //Static int[] v_empno = new int[30];

    // static int i =1;

    public static void main(String [] args) {
    Connection con = null;



    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;

    // Connect with a url string


    con = DriverManager.getConnection("jdbc:odbc:DB1");

    Statement s = con.createStatement();

    s.execute("select empno,NAME from EMP WHERE empno = " + b ); // select the data from the table
    ResultSet rs = s.getResultSet(); // get any ResultSet that came from our query

    System.out.println("Connection ok.");
    //String sql = "CREATE TABLE books3 (id NUMBER(11), title VARCHAR2(64))";
    //Statement statement = con.createStatement();
    //statement.execute(sql);

    if (rs != null) // if rs == null, then there is no ResultSet to view
    while ( rs.next() ) // this will step through our data row-by-row


    //v_empno[a] = rs.getString(1);
    //v_name[a] = rs.getString(2);

    {
    /* the next line will get the first column in our current row's ResultSet
    as a String ( getString( columnNumber) ) and output it to the screen */
    System.out.println("Data from column_name: " + rs.getString(1) + " " + rs.getString(2) );

    // System.out.println(a);
    // a= a+1;
    System.out.println("select " + b);
    }


    s.close(); // close the Statement to let the database know we're done with it
    con.close();





    } catch (Exception e) {
    System.err.println("Exception: "+e.getMessage());
    }
    }
    }

    ---end

Similar Threads

  1. has private access error message
    By ibrahimyoussof in forum Enterprise JavaBeans (EJB)
    Replies: 2
    Last Post: 04-13-2010, 04:01 PM
  2. Array Index Out Of Bounds and Problem in Assigning Values
    By chronoz1300 in forum New To Java
    Replies: 2
    Last Post: 12-28-2009, 07:14 PM
  3. Error: Access restriction
    By livnihai in forum Eclipse
    Replies: 1
    Last Post: 11-25-2009, 06:53 PM
  4. Assigning Words to an Array
    By ScaryJello in forum New To Java
    Replies: 10
    Last Post: 02-17-2009, 04:40 AM
  5. How to access array stored in database through JSTL
    By saurabh.joshi in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-19-2007, 01:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •