Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the link strings commonly used in JDBC database connections

Shulou Source: shulou.com Published: 2022-05-31 17:40:04 09月18日 Update

This article mainly explains "what are the link strings commonly used in JDBC database connections". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what are the link strings commonly used in JDBC database connections?"

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

Class.forName (oracle.jdbc.driver.OracleDriver) .newInstance ()

String url= "jdbc:oracle:thin:@localhost:1521:orcl"

/ / orcl is the SID of 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 is 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 is the 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 is the database name

Connection conn= DriverManager.getConnection (url)

7. PostgreSQL database

Class.forName (org.postgresql.Driver) .newInstance ()

String url = "jdbc:postgresql://localhost/myDB"

/ / myDB is the database name

String user= "myuser"

String password= "mypassword"

Connection conn= DriverManager.getConnection (url,user,password)

At this point, I believe that everyone on the "JDBC database commonly used to connect which link strings" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Data databases characters strings commonly used links content learning practical deeper interest practicality practical easy to operate methods more friends patterns websites channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Apple Xiaomi macOS vpn