mysql怎么查有效邮箱 mysql怎么查看当前密码
怎么查看mysql数据库连接地址
查看mysql数据库连接地址的步骤如下:
创新互联公司-专业网站定制、快速模板网站建设、高性价比兴和网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式兴和网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖兴和地区。费用合理售后完善,10余年实体公司更值得信赖。
我们需要准备的材料分别是:电脑、mysql查询工具
1、首先,打开mysql查询工具。
2、鼠标右击要查看的mysql连接,点击“编辑连接”按钮。
3、此时可以看到mysql连接的主机名或IP地址,以及端口号。
mysql判断邮件地址是否合法
import java.io.*;
import java.net.*;
import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;
public class SMTPMXLookup {
private static int hear( BufferedReader in ) throws IOException {
String line = null;
int res = 0;
while ( (line = in.readLine()) != null ) {
String pfx = line.substring( 0, 3 );
try {
res = Integer.parseInt( pfx );
}
catch (Exception ex) {
res = -1;
}
if ( line.charAt( 3 ) != '-' ) break;
}
return res;
}
private static void say( BufferedWriter wr, String text )
throws IOException {
wr.write( text + "\r\n" );
wr.flush();
return;
}
private static ArrayList getMX( String hostName )
throws NamingException {
// Perform a DNS lookup for MX records in the domain
Hashtable env = new Hashtable();
env.put("java.naming.factory.initial",
"com.sun.jndi.dns.DnsContextFactory");
DirContext ictx = new InitialDirContext( env );
Attributes attrs = ictx.getAttributes
( hostName, new String[] { "MX" });
Attribute attr = attrs.get( "MX" );
// if we don't have an MX record, try the machine itself
if (( attr == null ) || ( attr.size() == 0 )) {
attrs = ictx.getAttributes( hostName, new String[] { "A" });
attr = attrs.get( "A" );
if( attr == null )
throw new NamingException
( "No match for name '" + hostName + "'" );
}
// Huzzah! we have machines to try. Return them as an array list
// NOTE: We SHOULD take the preference into account to be absolutely
// correct. This is left as an exercise for anyone who cares.
ArrayList res = new ArrayList();
NamingEnumeration en = attr.getAll();
while ( en.hasMore() ) {
String mailhost;
String x = (String) en.next();
String f[] = x.split( " " );
// THE fix *************
if (f.length == 1)
mailhost = f[0];
else if ( f[1].endsWith( "." ) )
mailhost = f[1].substring( 0, (f[1].length() - 1));
else
mailhost = f[1];
// THE fix *************
res.add( mailhost );
}
return res;
}
public static boolean isAddressValid( String address ) {
// Find the separator for the domain name
int pos = address.indexOf( '@' );
// If the address does not contain an '@', it's not valid
if ( pos == -1 ) return false;
// Isolate the domain/machine name and get a list of mail exchangers
String domain = address.substring( ++pos );
ArrayList mxList = null;
try {
mxList = getMX( domain );
}
catch (NamingException ex) {
return false;
}
// Just because we can send mail to the domain, doesn't mean that the
// address is valid, but if we can't, it's a sure sign that it isn't
if ( mxList.size() == 0 ) return false;
// Now, do the SMTP validation, try each mail exchanger until we get
// a positive acceptance. It *MAY* be possible for one MX to allow
// a message [store and forwarder for example] and another [like
// the actual mail server] to reject it. This is why we REALLY ought
// to take the preference into account.
for ( int mx = 0 ; mx mxList.size() ; mx++ ) {
boolean valid = false;
try {
int res;
//
Socket skt = new Socket( (String) mxList.get( mx ), 25 );
BufferedReader rdr = new BufferedReader
( new InputStreamReader( skt.getInputStream() ) );
BufferedWriter wtr = new BufferedWriter
( new OutputStreamWriter( skt.getOutputStream() ) );
res = hear( rdr );
if ( res != 220 ) throw new Exception( "Invalid header" );
say( wtr, "EHLO rgagnon.com" );
res = hear( rdr );
if ( res != 250 ) throw new Exception( "Not ESMTP" );
// validate the sender address
say( wtr, "MAIL FROM: tim@orbaker.com" );
res = hear( rdr );
if ( res != 250 ) throw new Exception( "Sender rejected" );
say( wtr, "RCPT TO: " + address + "" );
res = hear( rdr );
// be polite
say( wtr, "RSET" ); hear( rdr );
say( wtr, "QUIT" ); hear( rdr );
if ( res != 250 )
throw new Exception( "Address is not valid!" );
valid = true;
rdr.close();
wtr.close();
skt.close();
}
catch (Exception ex) {
// Do nothing but try next host
ex.printStackTrace();
}
finally {
if ( valid ) return true;
}
}
return false;
}
public static void main( String args[] ) {
String testData[] = {
"real@rgagnon.com",
"you@acquisto.net",
"fail.me@nowhere.spam", // Invalid domain name
"arkham@bigmeanogre.net", // Invalid address
"nosuchaddress@yahoo.com" // Failure of this method
};
for ( int ctr = 0 ; ctr testData.length ; ctr++ ) {
System.out.println( testData[ ctr ] + " is valid? " +
isAddressValid( testData[ ctr ] ) );
}
return;
}
}
我想把mysql中的一个表里的字段添加上判定条件,比如必须是以@163.com结尾的邮箱才能插入,求高手
如果楼主只是考虑下这样做,无妨,有想法。但是这样做,个人认为劳时劳力,但结果还不会很理想,因为数据库本来就是对插入数据进行存储和管理,但是现在楼主试图让其对数据插入进行筛选,貌似越权了。这些操作应该时数据库操作的逻辑代码来做的,数据库来做会降低开发效率。
其他数据库记得可以用check来做,但是mysql好像check没作用
网站题目:mysql怎么查有效邮箱 mysql怎么查看当前密码
分享网址:http://hbruida.cn/article/ddoegdd.html