LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-16-2006, 01:17 AM   #1
jun_tuko
Member
 
Registered: Oct 2005
Location: Seattle, WA
Distribution: Fedora Core 4
Posts: 67

Rep: Reputation: 15
Need basic code to connect to MySQL using JSP / JAVA


hello gurus,
could you please help me write a very simple code to connect and insert data to mysql table using jsp? i've been googling around and found a lot of them but they weren't simple enough for me to understand what's going on.

here's my scenario:
1) i have an html file with form to fill out. when "submit" is clicked, i would like the data from the filled out form to be stored in mysql.
2) if you guys have time, could you show me how to retrieve those data from mysql and display it on my browser (just to make sure that the data did get stored in db)?

i've read some lines for php about this and i understand how it is done. so there should be a simple and easy to understand code to do this right? i'm thinking connect then insert.

thanks a lot guys!

jun tuko
 
Old 01-16-2006, 02:20 AM   #2
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
expect an answer from me in a week, if you wanna see the working code and theory.
 
Old 01-16-2006, 02:37 AM   #3
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
You use JDBC to do database connectivity in Java. If you do a Google search for JDBC tutorial you'll find a number of resources. It's fairly straightforward, but you will need to download and install the JDBC driver for MySQL which you can get from the MySQL Web site.

Sorry I'm not more detailed but it's been some time since I have used JDBC.
 
Old 01-16-2006, 02:43 AM   #4
vireshwali
Member
 
Registered: Sep 2005
Posts: 67

Rep: Reputation: 15
thats pointing to the right direction btmiller.
Alas guys here are not intrested in searching it out on the web but more in getting a ready made code to use. Hardly astonishing as i see very queries relating to very basic working of things here.
jun_tuko, buddy i would suggest you to have a look at a JDBC tutorial at sun.com.
Its simple and if you are good at programming then it should not take you more than 30 minutes to write your own source to insert,update,delete and select using JDBC.
Do get the mysql driver from mysql.com website. Its freely available.
 
Old 01-16-2006, 03:15 AM   #5
jun_tuko
Member
 
Registered: Oct 2005
Location: Seattle, WA
Distribution: Fedora Core 4
Posts: 67

Original Poster
Rep: Reputation: 15
thanks guys for looking and excuse my being a lamer. i normally check google and different forums before i post. its just that i'm a bit behind on my project at school which was originally set to use php and mysql, and which i'm already getting accustomed to, before the sudden change to jsp, javascript and mysql. the thing is i have to get this going by tomorrow night, so i was hoping i get the simple code here (if gurus dont mind) while i tinker with other problems i have like making tomcat work.

thanks guys!
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
[ JSP/JAVA ] MySQL connection fails White R4bbit Programming 4 04-27-2005 08:31 AM
java jsp ????? 2 databases Atrocity Programming 2 06-30-2004 10:26 AM
an error occur when jsp connect to mysql? shitian8848 Programming 2 06-04-2004 02:08 PM
Basic JSP/Tomcat question. CodeWarrior Programming 1 07-06-2003 09:15 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration