Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I'm write following code for displaying ipaddress
import java.net.*;
import java.io.*;
public class ipadd {
   public static void main(String [] args) {
      try {
         InetAddress thisIp =InetAddress.getLocalHost();
         System.out.println("IP:"+thisIp.getHostAddress());
         }
      catch(Exception e) {
         e.printStackTrace();
         }
      }
   }

how to update the resultant ipaddress into mysql database.
how to connect database from java to database.

[edit]Code block added, "Ignore HTML..." option disabled - OriginalGriff[/edit]
Posted
Updated 6-Mar-11 21:05pm
v2

cijiiiiiiiiii wrote:
how to connect database from java to database.

Seems like, the real question is - how to use mySQL database with java.

This article will help you understand JDBC.
http://www.vogella.de/articles/MySQLJava/article.html[^]
 
Share this answer
 
v2
You have to write JDBC program to connect your database, then write sql statements to store your IP address into Table.

<a href="http://www.kitebird.com/articles/jdbc.html">http://www.kitebird.com/articles/jdbc.html</a>[<a href="http://www.kitebird.com/articles/jdbc.html" target="_blank" title="New Window">^</a>]

<a href="http://www.vogella.de/articles/MySQLJava/article.html">http://www.vogella.de/articles/MySQLJava/article.html</a>[<a href="http://www.vogella.de/articles/MySQLJava/article.html" target="_blank" title="New Window">^</a>]
 
Share this answer
 
v2
mysql ->

https://sites.google.com/site/stark9000/java
 
Share this answer
 
Comments
Richard MacCutchan 12-Jun-11 7:11am    
This is not an answer, not even a useful (or usable) link.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900