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

mysql,sqlserver,oracle三种数据库的大对象存取

mysql 大对象存取:
  类型一般应该用mediumblod,
  blob只能存2的16次方个byte,
  mediumblod是24次方,
  一般来说够用了.longblob是32次方有些大.
  MYSQL默认配置只能存1M大小的文件,要修改配置,WIN版本的在mysql.ini文件中
  修改max_allowed_packet,net_buffer_length等几个参数,或直接SET GLOBAL varName=value.
  linux版本可以在启动参数后加-max_allowed_packet=xxM等几个参数.
  MYSQL存大对象最好直接就setBinaryStream,又快又方便.
  而不要先插入空再造型成BLOB然后再setBlob
  例子:
  import java.sql.*;
  import java.io.*;
  public class DBTest {
  
   static String driver = "org.gjt.mm.mysql.Driver";
   static String url = "jdbc:mysql://localhost:3306/test";
   static String user = "root";
   static String passwd = "passwd";
   public static void main(String[] args) throws Exception {
   Connection conn = null;
   try {
   Class.forName(driver);
   conn = DriverManager.getConnection(url,user,passwd);
  
   int op = 1;
   //插入
   if (op == 0) {
   PreparedStatement ps = conn.prepareStatement("insert into tb_file values (?,?)");
   ps.setString(1, "aaa.exe");
   InputStream in = new FileInputStream("d:/aaa.exe");
   ps.setBinaryStream(2,in,in.available());
   ps.executeUpdate();
   ps.close();
   }
   else {
   //取出
   PreparedStatement ps = conn.prepareStatement("select * from tb_file where filename = ?");
   ps.setString(1, "aaa.exe");
   ResultSet rs = ps.executeQuery();
   rs.next();
   InputStream in = rs.getBinaryStream("filecontent");
   System.out.println(in.available());
   FileOutputStream out = new FileOutputStream("d:/bbb.exe");
   byte[] b = new byte[1024];
   int len = 0;
   while ( (len = in.read(b)) != -1) {
   out.write(b, 0, len);
   out.flush();
   }
   out.close();
   in.close();
   rs.close();
   ps.close();
   }
   }
   catch (Exception ex) {
   ex.printStackTrace(System.out);
   }
   finall


相关文档:

MySQL存储过程实例

9.3  MySQL存储过程
MySQL 5.0以后的版本开始支持存储过程,存储过程具有一致性、高效性、安全性和体系结构等特点,本节将通过具体的实例讲解PHP是如何操纵MySQL存储过程的。
实例261:存储过程的创建
这是一个创建存储过程的实例
录像位置:光盘\mingrisoft\09\261
实例说明
为了保证数据的完整性、一致性,提 ......

mysql 相关网址...

)MySql 中文网:http://imysql.cn/onlinedoc
)MySQL 中文社区 :http://www.mysql.net.cn/
)MySql 百度百科:http://baike.baidu.com/view/24816.htm
参考资料:
MySql版本构架及索引文件介绍 
Linux服务器配置方案MySQL 
Winodws下IIS/Apache PHP MySQL的安装配置 
初学MySQL哪些需要你知道& ......

MySql 总结

1.从Windows命令行启动MySQL
要想从命令行启动mysqld服务器,您应当启动控制台窗口(或“DOS window”)并输入命令:
  C:\> C:\Program Files\MySQL\MySQL Server 5.0\bin\mysqld
  根据系统中MySQL安装位置的不同,前面的例子中使用的路径也不同。
  在非NT版本的Windows中,在后台启动mysqld。也 ......

Mysql Explain 详解

一.语法
explain < table_name >
例如: explain select * from t3 where id=3952602;
二.explain输出解释
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+
| id | select_type | table | type  | possible_keys     | key ......

mysql数据乱码问题原因及解决(总结篇)

 mysql数据乱码问题原因及解决(总结篇)
 
第一解决方法:
 
      乱码问题简单说就是数据库写入读取,网页文件,网页显示时几个环节的编码不一致造成的。
乱码问题
写入时:页面提取写入数据编码和写入数据库时编码不一致
读取时:读取后所用编码与数据库写入时不一致
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号