JAVA-MANI.BLOGSPOT.COM
Sunday, November 9, 2008
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;

public class StringFunction {
private static final String DRIVER = "com.mysql.jdbc.Driver";
private static final String URL = "jdbc:mysql://localhost/kodejava";
private static final String USERNAME = "root";
private static final String PASSWORD = "";

public static void main(String[] args) throws Exception {
Connection connection = null;
try {
Class.forName(DRIVER);
connection = DriverManager.getConnection(URL, USERNAME, PASSWORD);
DatabaseMetaData metadata = connection.getMetaData();

//
// Get string functions supported by database
//
String[] functions = metadata.getStringFunctions().split(",\\s*");

for (int i = 0; i < functions.length; i++) {
String function = functions[i];
System.out.println("Function = " + function);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
if (connection != null) {
connection.close();
}
}
}
}

Here is the result of string functions supported by MySQL database:

Function = ASCII
Function = BIN
Function = BIT_LENGTH
Function = CHAR
Function = CHARACTER_LENGTH
Function = CHAR_LENGTH
Function = CONCAT
Function = CONCAT_WS
Function = CONV
Function = ELT
Function = EXPORT_SET
Function = FIELD
Function = FIND_IN_SET
Function = HEX
Function = INSERT
Function = INSTR
Function = LCASE
Function = LEFT
Function = LENGTH
Function = LOAD_FILE
Function = LOCATE
Function = LOCATE
Function = LOWER
Function = LPAD
Function = LTRIM
Function = MAKE_SET
Function = MATCH
Function = MID
Function = OCT
Function = OCTET_LENGTH
Function = ORD
Function = POSITION
Function = QUOTE
Function = REPEAT
Function = REPLACE
Function = REVERSE
Function = RIGHT
Function = RPAD
Function = RTRIM
Function = SOUNDEX
Function = SPACE
Function = STRCMP
Function = SUBSTRING
Function = SUBSTRING
Function = SUBSTRING
Function = SUBSTRING
Function = SUBSTRING_INDEX
Function = TRIM
Function = UCASE
Function = UPPER

0 comments:

SUBSCRIBE VIA eMAIL

Enter your email address:

Delivered by FeedBurner

Recent Posts

Firefox 3

Counter

internet companies

Live Traffic Map

Subscribe Now