Common database JDBC Connection notation
Last Update:2017-02-28
Source: Internet
Author: User
Data | database
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 ( &nbSP; " jdbc:sybase:tds:mydbcomputernameorip:2638 ", susr, spwd "); //(Default-Username/Password: "DBA"/"SQL") 5. microsoft sqlserver (http://jtds.sourceforge.net) ; Class.forName ( "Net.sourceforge.jtds.jdbc.Driver" ); cn = drivermanager.getconnection ( "Jdbc:jtds:sqlserver://mydbcomputernameorip:1433/master", susr, spwd ); 6. Microsoft sqlserver (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:ODBC:" + sDsn, susr, spwd ); 8.db2 class.forname ("Com.ibm.db2.jdbc.net.DB2Driver"); string&Nbsp;url= "Jdbc:db2://192.9.200.108:6789/sample" cn = drivermanager.getconnection ( url, sUsr, sPwd ) 9.access because access is not run as a service, the URL method does not apply to him. Access can be found through ODBC or, in the form of a server mapping path, to. mdb files, see http://rmijdbc.objectweb.org/Access/access.html