1. Oracle
Class.forName( "oracle.jdbc.driver.OracleDriver" );
cn = DriverManager.getConnection( "jdbc:oracle:thin:@DbComputerNameOrIP:1521:SID", sUsr, sPwd );
#將 Oracle Client jdbc\lib\ 底下的 classes12.jar , 複製到 c:\classes12.jar
#Windows 環境變數 CLASSPATH 加入 c:\classes12.jar
2. SQL Server
Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );
cn = DriverManager.getConnection( "jdbc:microsoft:sqlserver://DbComputerNameOrIP:1433;databaseName=master", sUsr, sPwd );
#從 這裡 Down SQL Server JDBC Driver , 將解開後的 mssqlserver.jar,msbase.jar,msutil.jar 複製到 c:\
#Windows 環境變數 CLASSPATH 加入 c:\mssqlserver.jar,c:\msbase.jar,c:\msutil.jar
3.ODBC
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
Connection cn = DriverManager.getConnection( "jdbc:odbc:" + sDsn, sUsr, sPwd );
Apr 23, 2008
JDBC connect string
Subscribe to:
Post Comments (Atom)
0 意見:
Post a Comment