JDBC connection and SQL Query

JDBC connection and SQL Query

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,



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
query in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
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
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
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
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 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  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  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
SQL QUERY
SQL QUERY  am a having a table 'PROGRAMMER' with columns... C pascal Bhanu Sql... Pascal Sql Mahesh DBASE Cobol
jdbc query
jdbc query  write a query of how to print the values of any column present in database in reverse order
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-jdbc
sql-jdbc  how to execute select query using prepared statement
JDBC connection pooling
JDBC connection pooling  What is Connection pooling
upgrading sql query join
upgrading sql query join  upgrading sql query join
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
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
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
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  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
optimize sql query
optimize sql query  How to optimize sql query in mysql? Thanks
Query On JDBC - JDBC
Query On JDBC  Hello , I am trying to migrate from xls TO mysql in Linux platform.. I'm using JDBC ODBC Bridge Driver..String url = "jdbc:excel:./personal1.xls";System.out.println
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
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
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
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
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
PHP SQL close connection
;; $sql_result=mysql_query($sql,$connection) or exit("Sql Error"... PHP SQL close connection       PHP SQL close connection is used to close a connection between the PHP
creating jdbc sql statements - JDBC
creating jdbc sql statements  I had written the following program...)   Hi friend, i think, connection problem. i am sending jdbc...."); Connection con = null; String url = "jdbc:mysql://192.168.10.211
DataBase connection with sql - Struts
DataBase connection with sql  How to connect sql and send db error in struts? what are the tag should i code in struts-confic.xml
Java jdbc connection
Java jdbc connection  Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection
JDBC Connection Pool
JDBC Connection Pool In this section we will learn about JDBC Connection Pool... application will give you improved performance if you use the JDBC Connection pooling. What is JDBC Connection Pool? The database connection is expensive
jdbc & sql related project - JDBC
jdbc & sql related project  code using jdbc,odbc,swing,MySql classes... from a list and execute any sql query related to the selected database e.g... this sql query so that it can be executed and required data can be displayed
SQL connection error in android
SQL connection error in android  hi, i am android developer . recently i made one application connect with sql server 2005 using jtds...:sql:Exception : BUFFERDIR connection property invalid. if you have any answer
Hibernate SQL Query/Native Query
This tutorial describes Hibernate SQL Query, which is also known as Native Query
display sql query in hibernate
display sql query in hibernate  If you want to see the Hibernate generated SQL statements on console, what should we do
sql - JDBC
sql  hi am keerthi java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Source=:src...://www.roseindia.net/jdbc/jdbcconnectivity.shtml You will find the solution. Thanks
Java Jdbc connection
Java Jdbc connection  What are the steps involved for making a connection with a database or how do you connect to a database
JDBC connection
JDBC connection       The JDBC.... The JDBC includes execution of SQL queries return a result set over... we illustrates you JDBC url connection. The current Tutorial helps you

Ads