domingo, 5 de abril de 2009

JDBC ORACLE MYSQL MSSQL SERVER

ORACLE

Class.forName("oracle.jdbc.driver.OracleDriver");
String url = "jdbc:oracle:thin:@127.0.0.1:1521:OracleSID";
String user = "user";
String password = "password";
Connection conn = DriverManager.getConnection(url, user, password);

MySQL

Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://127.0.0.1/nameDatabase";
String user = "user";
String password = "password";
Connection conn = DriverManager.getConnection(url, user, password);


MS SQL Server

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
String url = "jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=DbName";
String user = "user";
String password = "password";
Connection conn = DriverManager.getConnection(url, user, password);