如何在数据库中存储ipaddress [英] how to store ipaddress in database
问题描述
我写了下面的代码来显示ipaddress
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();
}
}
}
如何将生成的ipaddress更新到mysql数据库中.
如何将数据库从Java连接到数据库.
[edit]已添加代码块,忽略HTML ..."选项已禁用-OriginalGriff [/edit]
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]
推荐答案
如何将数据库从Java连接到数据库.
how to connect database from java to database.
似乎,真正的问题是-如何在java中使用mySQL数据库.
本文将帮助您了解JDBC.
http://www.vogella.de/articles/MySQLJava/article.html [ ^ ]
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[^]
以
http://www.kitebird.com/articles/jdbc.html [ http://www.java- tips.org/other-api-tips/jdbc/how-to-connect-mysql-server-using-jdbc.html [
Start with
http://www.kitebird.com/articles/jdbc.html[^]
http://www.java-tips.org/other-api-tips/jdbc/how-to-connect-mysql-server-using-jdbc.html[^]
您必须编写JDBC程序来连接数据库,然后编写sql语句以将IP地址存储到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 ="新窗口> ^</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>]]
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>]
这篇关于如何在数据库中存储ipaddress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!