jdbc接続mysql oracle sql serverデータベースの接続文字列

855 ワード

jdbc mysql oracle sql serverデータベースに接続する接続文字列は、後で忘れないようにメモしてください.
//SQL Server
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").
newInstance();
conn = DriverManager.getConnection("jdbc:Microsoft:sqlserver://localhost:1433;DatabaseName=    ","   ","  ");
//Oracle
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:    ", "   ", "  ");
//Mysql
Class.forName("org.git.mm.mysql.Driver").newInstance();
conn =DriverManager.getConnection("jdbc:mysql://localhost:3306/    ","   ","  ");
//       :
jdbc:mysql://localhost:3306/    ?useUnicode=true
&characterEncoding=GB2312