Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
jdbc.java
Package: jspgouwushop.rar [view]
Upload User: szlmxq
Upload Date: 2014-01-31
Package Size: 740k
Code Size: 1k
Category:
Applet
Development Platform:
Java
- package yy;
- import java.io.*;
- import java.sql.*;
- public class jdbc {
- public jdbc() {
- }
- Connection conn = null ;
- //String re = "" ;
- //设置你的数据库ip
- //String dbip = "127.0.0.1" ;
- //设置你的数据库用户名和密码:
- //String use = "" ;
- //String pass = "" ;
- public java.sql.Connection getConn(){
- try{
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
- //String url ="jdbc:mysql://"+dbip+":3306/"+use+"?user="+use+"&password="+pass+"&useUnicode=true&characterEncoding=gb2312" ;
- conn= DriverManager.getConnection("jdbc:odbc:yyForum","xyworker","999");
- ///Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- }
- catch(Exception e){
- e.printStackTrace();
- System.out.println("chengfei");
- }
- return this.conn ;
- }
- public String ex_chinese(String str){
- if(str==null){
- str ="" ;
- }
- else{
- try {
- str = new String(str.getBytes("iso-8859-1"),"gb2312") ;
- }
- catch (Exception ex) {
- }
- }
- return str ;
- }
- public String getTime() {
- String datestr = "" ;
- try {
- java.text.DateFormat df = new java.text.SimpleDateFormat("yyyy-M-d HH:ss") ;
- java.util.Date date = new java.util.Date() ;
- datestr = df.format(new java.util.Date()) ;
- }
- catch (Exception ex) {
- }
- return datestr ;
- }
- }