JDBC Driver downloads and connections for various databases

Source: Internet
Author: User
Tags db2 informix postgresql sybase sybase database

various Database Drivers
Database name Description
Mysql http://www.mysql.com/products/connector/j/ Shipped. But need to download the latest for MySQL 4.1 or higher.
Oracle

http://sourceforge.net/project/showfiles.php?group_id=33291

Software/tech/java/sqlj_jdbc/index.html

Included.
SQL Server by Jtds http://sourceforge.net/project/showfiles.php?group_id=33291 Included. Support for Microsoft SQL Server (6.5, 7, and 2005)
Postgres Http://jdbc.postgresql.org/download.html Included 7.3 JDBC 3
SAP DB Http://www.sapdb.org/sap_db_jdbc.htm Included.
SyBase by Jtds http://jtds.sourceforge.net/ Included. Support Sybase (10, 11, 12)


Connection methods for various drives:
1. MySQL (http://www.mysql.com) Mysql-connector-java-2.0.14-bin.jar;
Class.forName ("Org.gjt.mm.mysql.Driver");
cn = Drivermanager.getconnection ("Jdbc:mysql://mydbcomputernameorip:3306/mydatabasename", SUSR, SPWD);
2. PostgreSQL (http://www.de.postgresql.org) Pgjdbc2.jar;
Class.forName ("Org.postgresql.Driver");
cn = Drivermanager.getconnection ("Jdbc:postgresql://mydbcomputernameorip/mydatabasename", SUSR, SPWD);
3. Oracle (http://www.oracle.com/ip/deploy/database/oracle9i/) classes12.zip;
Class.forName ("Oracle.jdbc.driver.OracleDriver");
cn = Drivermanager.getconnection ("Jdbc:oracle:thin:mydbcomputernameorip:1521:orcl", Susr, SPWD);
4. Sybase (http://jtds.sourceforge.net) Jconn2.jar;
Class.forName ("Com.sybase.jdbc2.jdbc.SybDriver");
cn = Drivermanager.getconnection ("jdbc:sybase:tds:mydbcomputernameorip:2638", Susr, spwd);
(Default-username/password: "DBA"/"SQL")
5. Microsoft SQL Server (http://jtds.sourceforge.net);
Class.forName ("Net.sourceforge.jtds.jdbc.Driver");
cn = Drivermanager.getconnection ("Jdbc:jtds:sqlserver://mydbcomputernameorip:1433/master", SUSR, SPWD);
6. Microsoft SQL Server (http://www.microsoft.com);
Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver");
cn = Drivermanager.getconnection ("Jdbc:microsoft:sqlserver://mydbcomputernameorip:1433;databasename=master", SUSR , spwd);
7. ODBC
Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
Connection cn = Drivermanager.getconnection ("JDBC:DBC:" + sDsn, SUSR, spwd);
8.DB2 class.forname ("Com.ibm.db2.jdbc.net.DB2Driver");
String url= "Jdbc:db2://192.9.200.108:6789/sample"
cn = Drivermanager.getconnection (URL, susr, spwd);
9.access because Access does not run as a service, the URL method does not apply to him. Access can also find. mdb files through ODBC or server map paths, see http://rmijdbc.objectweb.org/Access/access.html One, the connection of various database mode quick Check table

The following is a list of the ways in which databases use JDBC connections, which can be used as a manual.

1. oracle8/8i/9i database (thin mode)

Class.forName ("Oracle.jdbc.driver.OracleDriver"). newinstance ();
String url= "Jdbc:oracle:thin: @localhost: 1521:ORCL"; ORCL the SID for the database
String user= "Test";
String password= "Test";
Connection conn= drivermanager.getconnection (Url,user,password);

2. DB2 Database

Class.forName ("Com.ibm.db2.jdbc.app.DB2Driver"). newinstance ();
String url= "Jdbc:db2://localhost:5000/sample"; Sample is your database name
String user= "admin";
String password= "";
Connection conn= drivermanager.getconnection (Url,user,password);

3. SQL server7.0/2000 Database

Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver"). newinstance ();
String url= "Jdbc:microsoft:sqlserver://localhost:1433;databasename=mydb";
MyDB for the database
String user= "SA";
String password= "";
Connection conn= drivermanager.getconnection (Url,user,password);

4. Sybase database

Class.forName ("Com.sybase.jdbc.SybDriver"). newinstance ();
String url = "Jdbc:sybase:tds:localhost:5007/mydb";//mydb is your database name
Properties sysprops = System.getproperties ();
Sysprops.put ("User", "userid");
Sysprops.put ("Password", "User_password");
Connection conn= drivermanager.getconnection (URL, sysprops);

5. Informix Database

Class.forName ("Com.informix.jdbc.IfxDriver"). newinstance ();
String url = "Jdbc:informix-sqli://123.45.67.89:1533/mydb:informixserver=myserver;
User=testuser;password=testpassword "; MyDB for Database name
Connection conn= drivermanager.getconnection (URL);

6. mysql Database

Class.forName ("Org.gjt.mm.mysql.Driver"). newinstance ();
String url = "jdbc:mysql://localhost/mydb?user=soft&password=soft1234&useunicode=true& Characterencoding=8859_1 "
MyDB for Database name
Connection conn= drivermanager.getconnection (URL);

7. PostgreSQL Database

Class.forName ("Org.postgresql.Driver"). newinstance ();
String url = "Jdbc:postgresql://localhost/mydb"//mydb for database name
String user= "MyUser";
String password= "MyPassword";
Connection conn= drivermanager.getconnection (Url,user,password);

8, Access database directly with ODBC

Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
String url= "Jdbc:odbc:driver={microsoft Access Driver (*.mdb)};D bq=" +application.getrealpath ("/data/reportdemo.mdb ");
Connection conn = drivermanager.getconnection (URL, "", "");
Statement stmtnew=conn.createstatement ();


JDBC Driver downloads and connections for various databases

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.