0

I have a database which i have created using phpmyadmin. I need this database to be update programmatically using values i get from a java program. How would i go about doing this.

1

2 Answers 2

2

Simple database access in Java is achieved via JDBC. The exact commands you'd need to use depend on what sort of queries you want to execute, but any half-decent tutorial should cover both select and insert/update statements.

I'd recommend starting with Sun's JDBC Basics tutorial, and going from there.

If you have any specific points you're stuck on after following the tutorial, I'd recommend posting a follow-up question showing what you've tried to do, and why it's not working. However asides from perhaps getting an environment set up, JDBC isn't too tricky to use.

(Do remember to close your resources in a finally block though!)

Sign up to request clarification or add additional context in comments.

Comments

-1

i think this might work. not very sure

Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://localhost/login" ,"root","");
statement = connection.createStatement();

1 Comment

What makes you unsure if this would work, and how did you try to improve the answer to eliminate this potential confusion? IMHO, it's not very helpful to provide guesses, certainly not without justification behind them and suggesting how they might be used or extended into a concrete solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.