LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Need basic code to connect to MySQL using JSP / JAVA (https://www.linuxquestions.org/questions/programming-9/need-basic-code-to-connect-to-mysql-using-jsp-java-403867/)

jun_tuko 01-16-2006 01:17 AM

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

vireshwali 01-16-2006 02:20 AM

expect an answer from me in a week, if you wanna see the working code and theory.

btmiller 01-16-2006 02:37 AM

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.

vireshwali 01-16-2006 02:43 AM

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.

jun_tuko 01-16-2006 03:15 AM

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!


All times are GMT -5. The time now is 12:47 AM.