Hello im trying to connect database with my java program for register/login but im not doing well, i have online database on godaddy and i cannot connect with the java program i tryed with using the URLEncoder
and it works for registering but for loging in i cannot make it please help me to connect it...
show me the code and i will just change the host, username and password ...
Thank you ! :)
Stefce
146
Posting Pro
Recommended Answers
Jump to PostYou need to add .jar from mysql driver to your project and then just do like this...
public static void main(String[] args) { try { Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("server adress","username","password"); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery("querry"); while(rset.next()) { // do what ever you want... …
Jump to PostI work with this driver: "mysql-connector-java-5.0.4-bin"
When you download that in .jar extension you copy that in your project.
Then if you are using Eclipse you right click on it, from meni go to Build Path, Add to build Path. With that you add that library to your project.
Then …
All 6 Replies
Stefce
146
Posting Pro
milil
24
Newbie Poster
Stefce
146
Posting Pro
milil
24
Newbie Poster
jwenting
1,889
duckman
Team Colleague
Stefce
146
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.