A new programming idea (medium) attached:

Source: Internet
Author: User

Because it is too long: You can only separate the stickers in this way.

-------------------------------------------------------
Core Implementation bean
NtDB. java

Package dba;
/* Newtower database access */
/* Call example
Nttest
<% @ Page import = "java. util. *" %>
<% @ Page import = "java. text. *" %>
<% @ Page import = "dba. ntDB" %>
<%
NtDB nt = new ntDB ();
Nt.exe cuteQuery ("yw", "select * from msgboard_wjm ");

Out. println (new SimpleDateFormat (
"Yyyy-MM-dd HH: mm: ss. SSS"). format (new Date ()));
File: // out. println (new Date (). toString ());

Out. println ("<br> ");
Out. println (nt. rowCount );
Out. println ("<table border = 1> ");
For (int I = 0; I <nt. rowCount; I ++ ){


If (I = 0 ){
Out. println ("<tr> ");
For (int k = 0; k <nt. colCount; k ++ ){
Out. println ("<td> ");
Out. print (nt. fieldName [k]);
Out. print ("</td> ");
}
Out. println ("</tr> ");
}

Out. println ("<tr> ");
For (int j = 0; j <nt. colCount; j ++ ){
Out. println ("<td> ");
Out. println (nt. data [I] [j]);
Out. println ("</td> ");
}
Out. println ("</tr> ");
}
Out. println ("</table> ");
%>
*/

Import java. util .*;
Import java. lang .*;
Import java. text .*;
Import java. SQL .*;
Import java. SQL. Connection;
Import javax. SQL .*;
Import javax. naming .*;
Import javax. transaction .*;
Import java. io .*;
Import java.net .*;

Public class ntDB {
Private Connection con;
Private String connName;
Private Statement statement;
Private ResultSet rs = null;
Private ResultSetMetaData rsmd;
File: // additional Method
Private Hashtable ht_PinYin = new Hashtable (10 );

Public int rowCount;
Public int colCount;
Public String [] fieldName;
Public int [] fieldType;
Public int [] columnDisplaySize;
Public String [] [] data = null;
//// Additional Method

Public ntDB (){
RowCount =-1;
ColCount =-1;
}

Private void getConn (){
Try {
Context env = (Context) new InitialContext (). lookup ("java: comp/env ");
DataSource ds = (DataSource) env. lookup ("jdbc/" + connName );
Con = ds. getConnection ();
} Catch (Exception e ){
E. printStackTrace ();
Con = null;
}
}

Private void closeConn () throws Exception
{

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.