Results 1 to 3 of 3
- 04-30-2010, 04:33 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 4
- Rep Power
- 0
- 04-30-2010, 04:42 PM #2
Post the code with code tag.
Ramya:cool:
- 04-30-2010, 05:13 PM #3
Member
- Join Date
- Apr 2010
- Posts
- 4
- Rep Power
- 0
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
-
has private access error message
By ibrahimyoussof in forum Enterprise JavaBeans (EJB)Replies: 2Last Post: 04-13-2010, 04:01 PM -
Array Index Out Of Bounds and Problem in Assigning Values
By chronoz1300 in forum New To JavaReplies: 2Last Post: 12-28-2009, 07:14 PM -
Error: Access restriction
By livnihai in forum EclipseReplies: 1Last Post: 11-25-2009, 06:53 PM -
Assigning Words to an Array
By ScaryJello in forum New To JavaReplies: 10Last Post: 02-17-2009, 04:40 AM -
How to access array stored in database through JSTL
By saurabh.joshi in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 11-19-2007, 01:46 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks