java connection to the database

2011-07-26  来源:本站原创  分类:Industry  人气:79 

1.1, Oracle8/8i/9i database (thin model)
2.
3.Class.forName ("oracle.jdbc.driver.OracleDriver"). NewInstance ();
4.
5.String url = "jdbc: oracle: thin: @ localhost: 1521: orcl";
6.
7. / / Orcl is the database SID
8.
9.String user = "test";
10.
11.String password = "test";
12.
13.Connection conn = DriverManager.getConnection (url, user, password);
14.
15.2, DB2 database
16.
17.Class.forName ("com.ibm.db2.jdbc.app.DB2Driver"). NewInstance ();
18.
19.String url = "jdbc: db2: / / localhost: 5000/sample";
20.
21. / / Sample name for your database
22.
23.String user = "admin";
24.
25.String password = "";
26.
27.Connection conn = DriverManager.getConnection (url, user, password);
28.
29.3, Sql Server7.0/2000 database
30.
31.Class.forName ("com.microsoft.jdbc.sqlserver.SQLServerDriver"). NewInstance ();
32.
33.String url = "jdbc: microsoft: sqlserver: / / localhost: 1433; DatabaseName = mydb";
34.
35. / / Mydb database
36.
37.String user = "sa";
38.
39.String password = "";
40.
41.Connection conn = DriverManager.getConnection (url, user, password);
42.
43.4, Sybase database
44.
45.Class.forName ("com.sybase.jdbc.SybDriver"). NewInstance ();
46.
47.String url = "jdbc: sybase: Tds: localhost: 5007/myDB";
48.
49. / / MyDB name for your database
50.
51.Properties sysProps = System.getProperties ();
52.
53.SysProps.put ("user", "userid");
54.
55.SysProps.put ("password", "user_password");
56.
57.Connection conn = DriverManager.getConnection (url, SysProps);
58.
59.5, Informix Database
60.
61.Class.forName ("com.informix.jdbc.IfxDriver"). NewInstance ();
62.
63.String url =
64.
65. "Jdbc: informix-sqli: / / 123.45.67.89:1533 / myDB: INFORMIXSERVER = myserver;
66.
67.user = testuser; password = testpassword ";
68.
69. / / MyDB name for the database
70.
71.Connection conn = DriverManager.getConnection (url);
72.
73.6, MySQL database
74.
75.Class.forName ("org.gjt.mm.mysql.Driver"). NewInstance ();
76.
77.String url = "jdbc: mysql: / / localhost / myDB? User = soft & password = soft1234 & useUnicode = true & characterEncoding = 8859_1"
78.
79. / / MyDB name for the database
80.
81.Connection conn = DriverManager.getConnection (url);
82.
83.7, PostgreSQL Database
84.
85.Class.forName ("org.postgresql.Driver"). NewInstance ();
86.
87.String url = "jdbc: postgresql: / / localhost / myDB"
88.
89. / / MyDB name for the database
90.
91.String user = "myuser";
92.
93.String password = "mypassword";
94.
95.Connection conn = DriverManager.getConnection (url, user, password);

相关文章
  • java connection to the database 2011-07-26

    1.1, Oracle8/8i/9i database (thin model) 2. 3.Class.forName ("oracle.jdbc.driver.OracleDriver"). NewInstance (); 4. 5.String url = "jdbc: oracle: thin: @ localhost: 1521: orcl"; 6. 7. / / Orcl is the database SID 8. 9.String user = &qu

  • Using the Java connection pool to connect Oracle Database 2010-03-24

    1.Java four ways to connect the database 1 JDBC-ODBC bridge and ODBC driver - in this way, this is a local solution, because the ODBC driver and the bridge code must appear in each user's machine. Fundamentally speaking, this is a temporary solution.

  • Java connection pool using the Oracle database connection 2010-10-26

    1.Java four methods of connecting to the database program 1 JDBC-ODBC bridge and ODBC driver - in this way, this is a local solution, because the ODBC driver and the bridge code must appear in each user's machine. Fundamentally, this is a temporary s

  • JAVA connection ACCESS, SQL Server, MySQL, Oracle Database 2011-05-04

    import java.sql .*; / * * JAVA connection ACCESS, SQL Server, MySQL, Oracle Database * * * / public class JDBC { public static void main (String [] args) throws Exception { Connection conn = null; //==== Connection ACCESS database ==== / / Connection

  • Java connection pool using Oracle database 2010-10-26

    1.Java four methods to connect the database 1 JDBC-ODBC bridge and ODBC driver - in this way, this is a local solution, because the ODBC driver and the bridge code must appear in each user's machine. Basically this is a temporary solution. 2 native c

  • Matlab to establish a connection to Oracle database 2010-03-23

    1, Matlab to Oracle database through ODBC connection set up 1, in Windows under "Start" → "Control Panel" → "Performance and Maintenance" → "Administrative Tools", click on "Data Sources (ODBC)" 2, select

  • JSP review notes - Chapter 10, the connection to Oracle database, connect to the database 2010-10-26

    JDBC connection with Oracle database: Configure Oracle in Tomcat driver OracleJDBC location of the driver: oracle \ ora90 \ jdbc \ lib \ classes12.jar Copy this driver to: tomcat \ common \ lib Java code 1. <% @ Page contentType = "text / html; ch

  • JAVA to access firebird database of Jaybird 2011-01-02

    JAVA to access firebird database of Jaybird About Jaybird-2.1.6JDK_1.5 used as follows: First: Install Jaybird The first step: the root directory jaybird21.dll, GDS32.DLL, icudt30.dll, icuuc30.dll, fbembed.dll, icuin30.dll fbclient.dll (FB type for n

  • Java connection pooling basic working principle of 2010-10-24

    1, the basic concepts and principles We know, for the sharing of resources, there is a very well-known design pattern: resource pool (Resource Pool). The model was to address the frequent allocation of resources? Problems caused by the release. To ad

  • java dynamic create dynamic database and connect to the database 2011-05-22

    Project needs to dynamically create a database and to dynamically connect to the database, originally thought it would also be difficult to achieve it, on the Internet for a long time, not very satisfactory, and finally see people that create the dat

  • Thinkphp connection closed mssql database solution 2010-07-28

    Thinkphp officially support mssql, using the following configuration, not on how to connect even have to mssql database, it is depressing! config.php to configure the code: 'DB_TYPE' => 'mssql', 'DB_HOST' => '192 .168.0.8 ', 'DB_Name' => 'zhsheng

  • DAO connection to the database, is also very good 2011-10-22

    Prerequisite: Abstract Factory: Provide a series of related or dependent objects to create the interface, without specifying their concrete classes. Applicability: 1. A system should be independent of its products to create, combine, and that time. (

  • JAVA connection SQList database. 2011-09-16

    File-type database is a very special database. Because they do not have the network interface, usually not distributed call. But they have a very great advantage, if used for data configuration and data cache can improve software productivity. So man

  • java connection between the two time periods of the database query log 2011-06-26

    Recently made a hotel management system, which involves a lot of knowledge never learned before, now is off now. There is a problem confused me a long time, especially on the Internet to find no satisfactory answer, he summed up and sorted out. Quest

  • JAVA popular open source database 2009-07-15

    Jakarta common: Commons Logging Jakarta Commons Logging (JCL) to provide a log of (Log) interface (interface), both lightweight and is not dependent on the achievement of specific tools log. Available to the middle of it Pieces / log tool for develop

  • oracle java connection 2010-03-29

    I connected using a thin, this method is simple, but attention to a few questions are as follows: import java.sql .*; public class wanglei ( public static void main (String [] args) ( try ( Class.forName ( "oracle.jdbc.driver.OracleDriver"); / /

  • The use of Java to the Oracle database to insert data into BLOB data columns 2009-06-03

    To the Oracle Database Large Object lob the steps in the field to insert the data public int insertFileInfo(Eg_attachsfiles attachsfile,File file) { /* * The Orcale database BLOB data column to insert data operations division at few steps * In the ac

  • java connection Access 2010-05-15

    1. Create dbconnect.mdb file 2. In the Control Panel - "Administrative Tools -" data source configuration file to create a good dbconnect.mdb. 3.access do not need to import the package, because access does not support remote services, so there

  • java connect to the database url 2010-05-15

    1.Oracle database Class.forName ("oracle.jdbc.driver.OracleDriver"). NewInstance (); String url = "jdbc: oracle: thin: @ localhost: 1521: orcle"; String user = "test"; String password = "test"; Connection conn = Dri

  • Java to connect Access database 2010-05-27

    Access database username and password in two fields, the following java realize acess with access to the code below /** * Java Connecting to an Access database testing */ package Test; import java.sql.*; /** * @author sxch * */ public class AccessTes