经常接触的数据库驱动的链接方式
各种数据库的驱动在写法上还是存在一点差异的,比如SqlServer和PostgreSQL在感觉上存在很大的差异。PostgreSQL:
String connectionUrl = "jdbc:postgresql://192.168.100.207:5432/MySQL"; Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection(connectionUrl,"test","test");
SqlServer:
String connectionUrl = "jdbc:sqlserver://192.168.1.1;" + "databaseName=MySQL;user=test;password=test123"; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection conn = DriverManager.getConnection(connectionUrl);
to be continued。。。。。。
页:
[1]