一: 前期准备工作
l Crystal Report 2008
l JDBC 相关jar包 --- mysql-connector-java-5.1.22-bin.jar(MySQL)
Jar包下载:
mysql-connector-java-5.1.22-bin.jar (见附件)
JAR包添加:
1. 把JAR包放在水晶报表CrystalReport的目录下面
C:\Program Files\Business Objects\Common\4\java\lib\external
2. 然后找到 JAR包的配置文件CRConfig.xml
C:\Program Files\Business Objects\Common\4\java\CRConfig.xml
3. 打开CRConfig.xml
A. 更改水晶报表的JDK环境
<!--<JavaDir>C:\Program Files\Business Objects\javasdk\bin</JavaDir>-->
<JavaDir>C:\Program Files\Java\jdk1.6.0_06\bin</JavaDir>
B.在<Classpath>添加
<Classpath>C:\Program Files\Business Objects\Common\4.0\java/lib/external/mysql-connector-java-5.1.22-bin.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/crlovmanifest.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/CRLOVExternal.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/CRDBJDBCServer.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/CRDBXMLServer.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/CRDBJavaBeansServer.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/external/CRDBXMLExternal.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/external/log4j.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/CRDBSForceServer.jar;
C:\Program Files\Business Objects\Common\4.0\java/lib/external/CRDBSForceExternal.jar;${CLASSPATH}</Classpath>
JAR包添加完毕!
准备工作完成!
三: 打开Crystal Report 2008
打开file> new> stander report
Connection URL : jdbc:mysql://LOCAL_HOST:3306/DB_NAME
例如: --- ( jdbc:mysql://localhost:3306/db_name)
Database ClassName: com.mysql.jdbc.Driver
至此成功连接数据库.
END