Question:
How to insert data into a database?
di_kats
2008-02-18 09:31:44 UTC
I am writing a java aplication and i am using java gui forms I need help with inserting data into mysql database. I can get the data using getText() and statement.executeUpdate is the one Iam trying to use to insert However i dont know the how the insert query is writen in the statement the selct works fine i.e s.executeUpdate("SELECT * FROM tablename); or using Query instead of Update please help its a college project
Three answers:
nigel r
2008-02-18 10:40:11 UTC
Hi

To start off with you should understand the SQL to use, I tried to find a good example on the web which explained how to use updates in JDBC. The example below is just a code snippet, but it's a case of preparing an insert statement with ?'s as place holders for the values to be inserted and then using the various methods like setInt, setString to associate values with those place holders. Then the executeUpdate is the point at which the runtime applies the data.

Nige
2008-02-20 10:34:45 UTC
There are different scripting languages that can accomplish this. I personally use PHP. There are many free scripts out there that you can use as examples to get you started. You can find them by searching any of the search engines.
?
2016-10-25 07:16:56 UTC
Create table: create table verify (identity int no longer nul auto_increment wide-spread key, digital mail varchar(50)) verify no matter if consultation includes value or no longer.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...