Need basic code to connect to MySQL using JSP / JAVA
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.