Reputation: 1295
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.
Upvotes: 0
Views: 517
Reputation: 103837
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!)
Upvotes: 2
Reputation: 4340
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();
Upvotes: -1