Home Answers Viewqa Swing-AWT java to excel connectivity

 
 


raman
java to excel connectivity
1 Answer(s)      2 years and 10 months ago
Posted in : Swing AWT

give me source code to stored the value entered by user in a text field(such as name, age, sex, add. of the user etc.) that are on the jpanel to the database created in MSEXCEL 2007. actually i am making project on bank and i want to stored the information of customer to my database on the excel.
View Answers

July 23, 2010 at 1:23 PM


Hi Friend,

Follow these steps:

1. Open Data Sources (Start->Settings->Control Panel->Administrative Tool->Data Sources(ODBC)

2. Open User DSN tab
3. Add a user DSN
4. Select Microsoft Excel Driver(*.xls)
5. Select work book or excel file and Create the DSN name (e.g excel)
6. Click "Ok" and restart your compiler.
7. Compile the following java code:

import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;

class InsertToExcelDatabase extends JFrame {
JButton ADD;
JPanel panel;
JFrame f;

InsertToExcelDatabase(){
JLabel label1,label2;
final JTextField text1,text2;
label1 = new JLabel();
label1.setText("Name:");
text1 = new JTextField(20);

label2 = new JLabel();
label2.setText("Address:");
text2 = new JTextField(20);

ADD=new JButton("Insert");
ADD.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String v1=text1.getText();
String v2=text2.getText();
try {
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
Connection c = DriverManager.getConnection( "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:/database.xls; readOnly= false");
Statement stmnt = c.createStatement();
String insertSql = "Insert into [Excel Sheet$] (Name,Address) values ('"+v1+"', '"+v2+"')";
int insertSuccess = stmnt.executeUpdate(insertSql);
}
catch(Exception ex){}
}
});
f=new JFrame();
panel=new JPanel(new GridLayout(3,2));
panel.add(label1);
panel.add(text1);
panel.add(label2);
panel.add(text2);
panel.add(ADD);
f.add(panel,BorderLayout.CENTER);
f.setTitle("FORM");
f.setVisible(true);
f.pack();
}
public static void main(String[]args){
InsertToExcelDatabase ff=new InsertToExcelDatabase();
}
}

Thanks









Related Pages:
java to excel connectivity - Swing AWT
java to excel connectivity  give me source code to stored the value... excel) 6. Click "Ok" and restart your compiler. 7. Compile the following java... database on the excel.  Hi Friend, Follow these steps: 1. Open Data
connectivity
connectivity  how to connect java with database
excel
excel  how to read columns values of excel file in java and store in array list in java like col1 col2 2 3 1 7 7 9 then list1 have values of col1 and list2 have values of col2...  
java connectivity
java connectivity  hi........ Can u help me to do connectivity between java and weka??????? weka is a data mining tool which allows to do prediction, classification etc.... i want to do connectivity between weka and java can u
connectivity with access
connectivity with access  how to connect with data base with access...; Is this Access database or excel sheet. Do you want to display the values...;Is this Access database or excel sheet. Do you want to display the values in Textarea
database connectivity
database connectivity  describe java program steps in order to get connectivity to database along with example
java connectivity
java connectivity  i am trying to add dyanamic rows in the jsp page, when i add the new row the dropdown control value is not coming from database..please help me to overcome this problem
JDBC CONNECTIVITY
file in environment variable.   Java Mysql connectivity Other JDBC...JDBC CONNECTIVITY  How do i connect my database to java. I have the connector file and i place it in lib of jdk folder and installed the jdbc driver
JDBC CONNECTIVITY
// File name: Document [1].java /** * This class is generated from template... but when we run application i have an error message like this..." (""""""Java Tools.... Exception in thread "main" 'Java Tools >> Run Application' tool
connectivity step
connectivity step  sir.pls give me step one by one for connect the java program to oracle.   Follow these steps: 1) Import the following packages in your java file:*** import java.sql.*; import oracle.jdbc.driver.
sql connectivity through java
sql connectivity through java  i want an example for java db through sql connection. Thanks in advance
connectivity - JDBC
connectivity  How can we connect sql server using Java   Hi Friend, By using JDBC drivers, you can connect SQL server with java. Please visit the following link: http://www.roseindia.net/jdbc/jdbc.shtml
connectivity - JDBC
) org.apache.jsp.gui1_jsp._jspService(gui1_jsp.java:142...(DriverManager.java:171) org.apache.jsp.gui1_jsp._jspService(gui1_jsp.java:70
Validate telnet connectivity
Validate telnet connectivity  How to validate telnet connectivity in my java code
JDBC to EXcel
JDBC to EXcel  How to insert data in excel sheet from java
Java to SQL Server Connectivity
Java to SQL Server Connectivity  Hi, heres my code private void... with sql server connectivity at the background to save the data. Now, after... the connectivity wrong. Kindly help me resolve this issue ASAP. Thank you
Excel to database
Excel to database  Hi I want to update SQL database with the values from excel using java code. Can you help me
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou
database connectivity in java - JDBC
database connectivity in java  import java.io.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.sql.*; class Project implements ActionListener { JFrame f; JPanel p1,p2,p3; JTabbedPane
Java database connectivity
Java database connectivity  Hi sir I need a code to create an application where user enter name in text box and that should be stored in database. Plz help me out its very urgent.   import java.sql.*; import java.awt.
Connectivity with sql in detail - JDBC
Connectivity with sql in detail  Sir/Madam, I am unable to connect the sql with Java. Please tell me in detail that how to connect. Thankyou.  Hi Friend, Put mysql-connector
database connectivity using mysql
database connectivity using mysql  java file: eg1.java package eg; import java.sql.*; public class eg1 { public static void main(String arg[]) throws SQLException { try { String connectionURL = "jdbc:mysql
java servlet connectivity problem with access
java servlet connectivity problem with access  Import java.sql javax.servlet //all packages entered try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc
how to use Excel Templet to write excel file using java.
how to use Excel Templet to write excel file using java.  how to use Excel Templet to write excel file using java
jdbc connectivity through jsp
jdbc connectivity through jsp  my code: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http
DataBase connectivity in java with Microsoft sql server2000 - JDBC
DataBase connectivity in java with Microsoft sql server2000  How i can achieve database connectivity with Microsoft sql server2000 in my java source code
Servlets mysql connectivity
Servlets mysql connectivity  please tell me the steps to connect mysql with java servlets using connector j
excel to database
excel to database   How to export data from excel sheet to mysql database by using java with request parameter Here q=40 is a request parameter ..request parameter using i export the all data to database   <
database connectivity - JDBC
database connectivity  example java code for connecting Mysql... java : import java.sql.*; public class MysqlConnect{ public static void...(); } } } For more information on JDBC in java visit to : http://www.roseindia.net/jdbc
JDBC Connectivity - JDBC
JDBC Connectivity  my question is how to connect a Java program with MS-Access database?  Hello Use this code import java.sql.... String filename = "d:/java/mdbTEST.mdb"; String database = "jdbc
MySQL connectivity - JDBC
MySQL connectivity  hi all, i am not able to connect Mysql to java ..as i connect it ..i am getting the error ..saying classNotFoundException:com.mysql.jdbc.Driver....could anybody help in this regard.....waiting for a reply
Excel Column change
Excel Column change  How to change sequence of columns in Excel sheet through Java
how to use Excel Template to write excel file using java
how to use Excel Template to write excel file using java  How to use Excel template to write data in that file using java
Java vs Oracle Connectivity - JDBC
Java vs Oracle Connectivity  Write a java program to establish connection with oracle database?  Hi Friend, Use Oracle with Java Follow these steps: 1) Import the following packages in your java file
Excel file Handling in Java
Excel file Handling in Java  Hello Sir, I am new to Java, I have Started Java Core by myself. I want to make a project which include 3-4 Excel file...://www.roseindia.net/tutorial/java/poi/readExcelFile.html   Now to create an excel file
reading excel sheet in java
reading excel sheet in java  can anyone tell me a proper java code to read excel sheet using poi   Here is a java code that reads an excel file using POI api and display the data on the console. import java.io.
ODCB-EXCEL - Java Beginners
ODCB-EXCEL  Hi, i would like to extract data from an excel file. my excel file name is: TEST.xls the worksheet name is : qas i have configure...: "java.sql.SQLException: [Microsoft][Pilote ODBC Excel] Not enough parameters 1
Help me on database connectivity in J2ME - Java Beginners
Help me on database connectivity in J2ME  i want help in J2ME. i want code for database connection with MySQL. spcl to fecth and insert data from databse. please help me
To read a excel with chart - Java Beginners
To read a excel with chart   Hi, I need to read the data in an excel which is in chart format using java. when I directly change the extention of excel file to CSV i am not getting the data in the chart.Please help me
Java and excel - JDBC
Java and excel  i want to retrive records from my database to a Jtable from where i can export to excel, i will like to format the column headers in excel using code. plz i nd help becos it is my project, as a serious student i
Excel conversion tool. - Java Beginners
Excel conversion tool.  Hi, I need a conversion tool which can convert .xls(Excel 2003) to .xlsx (Excel 2007) and vice-versa. Please suggest any links ro tools. Thank You
excel file using JDBC java.?
excel file using JDBC java.?  hey, i am a telecomm. engineer , and i am try to develop a tool which reads from a excel file and then appends the same excel file as required. i am writing my code on notepad and have successfully
export java to excel - Java Beginners
export java to excel  How do you export java to excel?  You mean to say accessing Microsoft files in java? Then you can go for Apache POI. Its an API to access MS-Office files.Try using it. - Ramesh A.V
JDBC-Odbc Connectivity
JDBC-ODBC Connectivity     ... Connectivity. The code helps you in retrieve the name and size of the column... between front-end application in java and database in the backend.  
connect jdbc to an Excel spreadsheet
excel) Click "Ok" and restart your compiler. Compile the following java code...connect jdbc to an Excel spreadsheet  hello, How can I connect to an Excel spreadsheet file using jdbc?   Hello Friend, Follow
Excel file wriring using java
Excel file wriring using java  i have one predefined bill format in excel i want to append values in it using java apche POI or Jexcel i tried it but it overwrites file and lost previous contents what can i do
Java servlet sql connectivity error - JSP-Servlet
Java servlet sql connectivity error  Hi, I have been trying to connect to sql database via the servlet program in java.I have not been successful so far. However when i try to connect to sql through a normal java program

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.