易截截图软件、单文件、免安装、纯绿色、仅160KB

java access sql

JDBC连接MySQL
加载及注册JDBC驱动程序
Class.forName("com.mysql.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
JDBC URL 定义驱动程序与数据源之间的连接
标准语法:
<protocol(主要通讯协议)>:<subprotocol(次要通讯协议,即驱动程序名称)>:<data source identifier(数据源)>
MySQL的JDBC URL格式:
jdbc:mysql//[hostname][:port]/[dbname][?param1=value1][&param2=value2]….

示例:jdbc:mysql://localhost:3306/sample_db?user=root&password=your_password

常见参数:
user 用户名
password 密码
autoReconnect 联机失败,是否重新联机(true/false)
maxReconnect 尝试重新联机次数
initialTimeout 尝试重新联机间隔
maxRows 传回最大行数
useUnicode 是否使用Unicode字体编码(true/false)
characterEncoding 何种编码(GB2312/UTF-8/…)
relaxAutocommit 是否自动提交(true/false)
capitalizeTypeNames 数据定义的名称以大写表示
建立连接对象
String url="jdbc:mysql://localhost:3306/sample_db?user=root&password=your_password";
Connection con = DriverManager.getConnection(url);
建立SQL陈述式对象(Statement Object)
Statement stmt = con.createStatement();
执行SQL语句
executeQuery()
String query = "select * from test";
ResultSet rs=stmt.executeQuery(query);
结果集ResultSet
while(rs.next())
{rs.getString(1);rs.getInt(2);}
executeUpdate()
String upd="insert into test (id,name) values(1001,xuzhaori)";
int con=stmt.executeUpdate(upd);
execute()


相关文档:

Java中 ArrayList、Vector和LinkedList 的使用


ArrayList是最常用的List实现类,内部是通过数组实现的,它允许对元素进行快速随机访问。数组的缺点是每个元素之间不能含有“空隙”,当数组大小不满足时需要增加存储能力,就要将已有数组数据复制到新的存储空间中。当从ArrayList的中间位置插入或者删除元素时,需要对数组进行复制、移动,代价比较高。因此, ......

用JAX WS实现java调用webServic

来个简单点的:
1.建个具体的服务实现:
package com.webservice;
@WebService
public class Warehouse {
 private Map<String, Double> prices;
 public Warehouse() {
  prices = new HashMap<String, Double>();
  prices.put("Blackwell Toaster", 24.95);
 & ......

Java 俄罗斯方块

import java.awt.*;
import java.awt.event.*;
//俄罗斯方块类
public class ERS_Block extends Frame{
 public static boolean isPlay=false;
 public static int level=1,score=0;
 public static TextField scoreField,levelField;
 
 public static MyTimer timer;
 Ga ......

VC修改Access密码

void ModifyDBCode()
{
 CString strPath;
 ::GetModuleFileName(GetModuleHandle(NULL),strPath.GetBuffer(256),256);
 strPath.ReleaseBuffer();
 int flag=strPath.ReverseFind('\\');
 int size=strPath.GetLength();
 strPath.Delete(flag,size-flag);
 strPath= strPath+ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号