ͨ¹ýjava²éѯÊý¾Ý¿â±í½á¹¹
public static void getConnAndTableStruct() {
Connection connection = null;
PreparedStatement pstmt = null;
ResultSetMetaData rsmd = null;
try {
// mysqlÁ¬½Ó
//Class.forName("org.gjt.mm.mysql.Driver");
//connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
// oracleÁ¬½Ó
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@192.168.12.12:1521:db";
connection=DriverManager.getConnection(url,"manager","manager");
pstmt = (PreparedStatement) connection.prepareStatement("select * from A_STAT");
pstmt.execute(); // ÕâµãÌرðҪעÒâ:Èç¹ûÊÇOracle¶ø¶ÔÓÚmysql¿ÉÒÔ²»ÓüÓ.
rsmd = (ResultSetMetaData) pstmt.getMetaData();
//className = "User";
//tableName = "user";
for (int i = 1; i < rsmd.getColumnCount() + 1; i++) {
//rsmd.getColumnName(i);
//rsmd.getColumnClassName(i).substring(rsmd.getColumnClassName(i).lastIndexOf(".") + 1);
System.out.println(rsmd.getColumnClassName(i));
System.out.println(rsmd.getColumnName(i));
System.out.println(rsmd.getColumnTypeName(i));
System.out.println(rsmd.getPrecision(i));
System.out.println(rsmd.getScale(i));
System.out.println(rsmd.isNullable(i));//0 ²»ÄÜΪ¿Õ 1¿ÉÒÔΪ¿Õ
System.out.println("=============================");
System.out.println("=============================");
System.out.println("=============================");
System.out.println("
Ïà¹ØÎĵµ£º
Ôڳɹ¦ÊµÏÖJavaµ÷ÓÃC++Ö®ºó£¬½ÓÏÂÀ´Ïëµ½ÄÜ·ñͨ¹ýJNAʵÏÖJavaµ÷ÓÃFortran£¬½ñÌìÊÔÑéÁËһϣ¬»¹ÊDZȽÏÈÝÒ׵ġ£
ÍøÉÏÓÐÒ»¸öJavaµ÷ÓÃF95µÄÀý×Ó£¬µ«ÊÇÎÒ¿¼ÂDz»½öҪʵÏÖF95µÄµ÷Ó㬻¹ÒªÊµÏÖF77µÄµ÷Óã¬ËùÒÔ·ÑÁËһЩÖÜÕÛ¡£
ÎÊÌâµÄ¹Ø¼üÔÚÓÚF77Ϊ¹ý³ÌÃû×Ô¶¯Ìí¼ÓÁËÒ»¸öβ²¿µÄÏ»®Ïߣ¬ËùÒÔsub1Õâ¸ö¹ý³Ì£¬µ½JavaÒ»¶Ë£¬¾Í±ä³ÉÁËsub1_£¬ ......
Ç°Ì᣺JDKÔÚ»·¾³±äÁ¿ÀïÓÐÅäÖà 1.Ê×ÏȽ¨¸ö¹¤³ÌTest£¨¼ÙÈç·ÅÓÚD:\java£©½«srcĿ¼ÏµÄÎļþ¿½±´µ½classesĿ¼Ï 2.ÔËÐÐÀïÊäÈëcmd->»Ø³µ 3.ÊäÈëD:->»Ø³µ 4.ÊäÈëcd java»Ø³µ(cdδ´ò¿ªÎļþ¼Ð) 5.ÊäÈëcd test->»Ø³µ 6.ÊäÈëcd classes->»Ø³µ 7.ÊäÈëdir->»Ø³µ£¨dirΪÏÔʾ¸ÃĿ¼ÏµÄËùÓÐÎļþ£© 8.¶Ôÿ¸ö.javaÎ ......
import java.io.File;
import java.util.Date;
import java.util.Iterator;
import java.util.Vector;
import java.text.SimpleDateFormat;
public class FileViewer {
File myDir;
File[] contents;
Vector vectorList;
Iterator currentFileView;
File currentFile;
  ......
´´½¨Ò»¸öJFrame
ÏÂÃæÓüòµ¥µÄʵÀýÑÝʾÁËJava Swing´´½¨Ò»¸öÄÜÊäÈëÄÚÈݵĴ°¿Ú
public class frameTest(){
public static void Main(String args[]){
//´´½¨JFrame¶ÔÏó£¬JFrameÓÃÀ´ÔÚÆÁÄ»ÉÏÏÔʾһ¸öWindows´°¿Ú¡£
JFrame frame = new JFrame("µÚÒ»¸öJFrame"); &nbs ......
ÔÚjavaÖÐÓÐ3¸öÀàÀ´¸ºÔð×Ö·ûµÄ²Ù×÷¡£
1.Character ÊǽøÐе¥¸ö×Ö·û²Ù×÷µÄ£¬
2.String ¶ÔÒ»´®×Ö·û½øÐвÙ×÷¡£²»¿É±äÀà¡£
3.StringBuffer Ò²ÊǶÔÒ»´®×Ö·û½øÐвÙ×÷£¬µ«ÊǿɱäÀà¡£
String:
ÊǶÔÏó²»ÊÇÔʼÀàÐÍ.
Ϊ²»¿É±ä¶ÔÏó,Ò»µ©±»´´½¨,¾Í²»ÄÜÐÞ¸ÄËüµÄÖµ.
¶ÔÓÚÒѾ´æÔÚµÄString¶ÔÏóµÄÐÞ¸ ......