Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-17-2008, 12:32 AM
Member
 
Join Date: Apr 2008
Posts: 4
naipulb is on a distinguished road
Java program that transfers stock prices to MySQL database
Hi

Jag want to bring stock prices from csv files (excel) on the internet and copy them to a MySQL database through a Java program. I have downloaded the following:

-Eclipse
-MySQL server 5.0
-MySQL Connector/J

With this installed I should be able to edit mySQL databases through JDBC, but I don't know so much more. Can somebody help me to get started?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-17-2008, 04:45 PM
sukatoa's Avatar
Senior Member
 
Join Date: Jan 2008
Location: Cebu City, Philippines
Posts: 526
sukatoa is on a distinguished road
Send a message via Yahoo to sukatoa
Quote:
Can somebody help me to get started?
have some tutorials about it first....

sukatoa
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 06:02 PM
DonCash's Avatar
Moderator
 
Join Date: Aug 2007
Location: London, UK
Posts: 239
DonCash will become famous soon enoughDonCash will become famous soon enough
You will need to create a new Java project in Eclipse. Once complete, right click the project in the Package window and click 'Properties' Then navigate to 'Java Build Path' Click 'Add JARs' and locate the MySQL JDBC driver. Add it and click OK..

Then you can use this code to connect to the database:

Code:
import java.sql.*; public class Connect { public static void main (String[] args) { Connection conn = null; try { String userName = "testuser"; String password = "testpass"; String url = "jdbc:mysql://localhost/test"; Class.forName ("com.mysql.jdbc.Driver").newInstance (); conn = DriverManager.getConnection (url, userName, password); System.out.println ("Database connection established"); } catch (Exception e) { System.err.println ("Cannot connect to database server"); } finally { if (conn != null) { try { conn.close (); System.out.println ("Database connection terminated"); } catch (Exception e) { /* ignore close errors */ } } } } }
__________________
Did this post help you? Please
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
me!

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in connecting to mysql database nancyv Java Servlet 6 04-02-2008 12:33 PM
Problem with jTable that is binded with a table in MySQL Database rajkenneth NetBeans 0 03-29-2008 04:36 PM
Help needed with updating mysql database SilentCodingOne New To Java 1 12-11-2007 11:23 PM
How to execute an External Program through Java program JavaBean Java Tips 0 10-04-2007 10:33 PM
connecting to mysql database javagal NetBeans 2 08-04-2007 01:36 PM


All times are GMT +3. The time now is 06:17 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org