package com.kevin.mysql; /* * mysql 插入blog的例子 * */ import java.io.*; import java.sql.*; public class DBTest { public static void main(String[] args) { String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GBK"; String user = "root"; String password = "";...
by linux_wuliqiang - MySQL文档中心 - 2008-11-26 14:47:50 阅读(1440) 回复(0)
mysql是用php获得的数据写的数据查看为乱码'?????°.txt' php从数据库可以正常读出来“中文.txt” 现在另一地方要用ajax技术也从数据库把'?????°.txt'读出来,也显示“中文.txt” mysql是用的utf8编码,页面也是utf8编码
此实现为用java访问mysql的blob,对图片进行存取 /** * Title: BlobPros.java * Project: test * Description: 把图片存入mysql中的blob字段,并取出 * Call Module: mtools数据库中的tmp表 * File: C:downloadsluozsh.jpg * Copyright: Copyright (c) 2003-2003 * Company: uniware * Create Date: 2002.12.5 * @Author: ChenQH * @version 1.0 版本* * * Revision ...
1. jdk, jre 和 jvm 的区别 -- jdk 安装时, 总会装2套 jre a. JDK home 下有个jre 目录 b. Program file/javasoft (for 1.3); program files/java (for 1.4) 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/68079/showart_1217452.html
package test; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.HttpURLConnection; /** * 写了个和php的 file_get_contents("http://bbs.my.com/test/test8.php?a=1"); 一样的功能的东东 * * @author 流水孟春 */ public class F { public static void main(String[] args) throws Exception { String url = "htt...
import java.io.File; import org.w3c.dom.Document; import org.w3c.dom.*; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; public class ReadAndPrintXMLFile{ public static void main (String argv []){ try { DocumentBuilderFactory docBuilderFactory = DocumentBui...
java中的图片处理是很让人头疼的一件事情。目前java api中的imageIO可以将gif图片转换成png图片,jpg图片可以正常转换。据说gif转jpg也是有办法的,但是将jpg转成gif,我费了很大的工夫才找到一个很好的解决方案。 首先介绍的是一段很好的缩放图片的代码:: public static BufferedImage resize(BufferedImage source, int targetW, int targetH) { // targetW,targetH分别表示目标长和宽 int type = source...
package example; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class FileTransfer { public static void main(String[] args) { try { byte imageDataByte[] = new byte[20000]; String stmp = "" ; String hexStr = ""; FileInputStream fis = new FileInputStream(new File("D:\\sh...
java操作图片可以用 javax.imageio 包或GEF的Draw2D java操作图片可以用 javax.imageio 包或GEF的Draw2D,但我觉得简单就是美,所以用了调用外部程序的方法:imagemagick 我的需要是对一张400*430的jpeg文件剪切,然后存为tga格式 process = Runtime.getRuntime().exec("convert a.jpeg crop 400x380+0+0 a.tga"); 一句搞定,有比这更简单的吗? 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.ne...
Image img = (new ImageIcon(Drawing.class.getResource("images\\title.gif"))).getImage(); 目录结构如下: 图片: c:\myjava\classes\images\title.gif class:c:\myjava\classes\Drawing.class 可以取到图片。 程序改成: Image img = (new ImageIcon(Drawing.class.getResource("..\\images\\title.gif"))).getImage(); 目录结构如下: 图片:c:\myjava\images\title.gif class: c:\myjava\classes\Drawing.class 却取不...