Kiran
JDBC connection and SQL Query
1 Answer(s)      4 years and 11 months ago
Posted in : JDBC
Hi,

I'm reading a all files one after the other in a directory in java. storing the values in an array of string each time. Now I'm trying to execute a query to insert those values into an oracle DB. But I'm trying hard to figure out syntax for inserting into a table using variables. I'm trying to execute following command. Though I use executeQuery or udate Query it is not accepting as the format for them is executeQuery(String). My goal is to insert into Names Table values stored in temp[0] and temp[1]. In short I read values in array of temp, and I need to insert into DB using those variables, please give me proper syntax with quotation marks as I'm finding hard to make it. even the code i wrote below has some error with quotation marks. but i donno where to place them.


while((s3=reader.readLine())!=null){
String [] temp = null;
temp = s3.split(",");
statement.updateQuery("insert into Names values"+temp[0],""+temp[1]);

thanks,



Advertisement
View Answers

June 7, 2010 at 12:33 PM


Hi Friend,

Please visit the following link:

http://www.roseindia.net/tutorial/java/io/insertFileData.html

Hope that it will be helpful for you.
Thanks









Related Tutorials/Questions & Answers:
JDBC connection and SQL Query - JDBC
JDBC connection and SQL Query  Hi, I'm reading a all files one... each time. Now I'm trying to execute a query to insert those values into an oracle... or udate Query it is not accepting as the format for them is executeQuery(String
sql query - JDBC
sql query  I need a SQL query to add data into database
Advertisements
SQL QUERY - JDBC
SQL QUERY  I m running a query using apache tomcat the sql query is on adding an employee in the database whenever i click on add after inserting the values i am getting a java.lang.nullpointer exception
JDBC- SQL spatio-temporal query
JDBC- SQL spatio-temporal query  Any one give me a JDBC sql query for my spatio temporal query? Trajectory table OBJID PLACE 7 H 8 Q 9 W 10... as shown in above. I want a spatio-temporal query using JDBC-SQL to retrieve
JDBC- SQL spatio-temporal query
JDBC- SQL spatio-temporal query  Any one give me a JDBC sql query for my spatio temporal query? Trajectory table OBJID PLACE 7 H 8 Q 9 W 10... as shown in above. I want a spatio-temporal query using JDBC-SQL to retrieve
Database connection sql server 2005 - JDBC
Database connection sql server 2005  Hi all i am developing an application in struts and i need to connect database for that application using sql server 2005.. can anyone tell me how to make database connection ..plz help me
JDBC Connection code to connect servlet with SQL Server 2008
JDBC Connection code to connect servlet with SQL Server 2008  Please... support for JDBC 4.0. i try Avery thing but i m not success so please ans me . My connection code is static Connection con; static Statement st; static
jdbc connection
"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://127.0.0.1...jdbc connection  How to Submit data????   <%-- view... { Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection
connection - SQL
connection  how can i establish connection between netbean_ide6.9 with mysql or oracle  Hi Friend, Please visit the following link: http://www.roseindia.net/jsf/visual-jsf.shtml Hope that it will be helpful
Sql Query
Sql Query  Is this query work in Db2 or not ? Select * from FORUM LIMIT 2
Sql Query
Sql Query  Is this query work in Db2 or not ? Select * from FORUM LIMIT 2
query in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
sql query
sql query  two tables are emp,loc write a query to display all the emp information whose locname not equal to bangalore
Sql Query
Sql Query  Hi M Navjeet Ghai I want to know How to Show A name(Like Navjeet Ghai And Manpreet Singh Sodhi) of employees from a employee table as N.Ghai & M.S.Sodhi by using sql query
sql query
sql query  hi friend, Im doing a project,in that a main id... numbers of sids.i want to delete the sid based on the mid.for that i need sql query plz help to me
sql query
sql query  hi friend, Im doing a project,in that a main id... numbers of sids.i want to delete the sid based on the mid.for that i need sql query plz help to me
sql query
sql query  hi friend, Im doing a project,in that a main id... numbers of sids.i want to delete the sid based on the mid.for that i need sql query plz help to me
SQL Query
SQL Query  Selecting the third highest salary of Employee without using any subquery?   Here is a query: SELECT salary FROM employee ORDER BY salary DESC LIMIT 2,1
JDBC connection
JDBC connection  ![alt text][1]I got exception in Connecting to a MySQL Database in Java. The exception is ClassNotFoundException:com.mysql.jdbc.Driver wat is the problem
SQL QUERY
SQL QUERY  am a having a table 'PROGRAMMER' with columns... C pascal Bhanu Sql... Pascal Sql Mahesh DBASE Cobol
sql query - SQL
sql query  hi sir,i have a month and year numbers,when i am enter a month and year in sql query then i want results for 1st day of month to last day..."); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost
j2me jdbc connection - JDBC
j2me jdbc connection  hello, whn i m importing sql package in mine midlet(tried for both javax.sql.* and java.sql.*;)..itz nt accepting it... hw to get connected to database?????.... plz help me out
jdbc query
jdbc query  write a query of how to print the values of any column present in database in reverse order
Sql Connection is not creating
Sql Connection is not creating  Hi i am developing an web application..for that i am using excel as database. To connect for database am using jdbc... it is creating sql connection and allwoing me to access excel but when i am
sql query
sql query  SQL QUERY BROWSER declare @cout00 int declare @cout01 int declare @cout10 int declare @cout11 int declare @c1 float declare @gss float...); this is the query i have written for the table "dpscomp" - station date month
JDBC connection pooling
JDBC connection pooling  What is Connection pooling
SQL Query - SQL
SQL Query  Hi I would like to know how to create a SQL query which would copy values from a field which contains multiple values to an existing... | +-----+-----------+-------------+ Query: INSERT INTO table2 (fruit1, fruit2, fruit3
query - SQL
tell me how to write the query in database but not jsp code. thank u
SQL query
SQL query  I need to combine two tables in order to get the values. As an example we have three tables having namely usertable,job table and jobaccess table. In usertable (Userid,Empid,name,Role) details have been stored
SQL query - SQL
("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:access...SQL query  hi sir/Madam i am using MS Access where i have table like Fees_Struc: Amount (INT) Due_Date (Date) Fees_Pay: Paid(INT
jdbc query
jdbc query  hello sir I have used your simple bank application... but it show sql exception error data type mismatch in criteria expression. But I have used your complete project with My SQL database it showed the transaction