String connectionUrl = "jdbc:sqlserver://localhost encrypt=true database=AdventureWorks integratedSecurity=true "Ĭonnection con = d.connect(connectionUrl, new Properties()) Ĭreating a connection by using the SQLServerDataSource class If you have to specify a particular driver in the list of drivers for DriverManager, you can create a database connection by using the connect method of the SQLServerDriver class, as in the following: Driver d = (Driver) Class.forName(".SQLServerDriver").newInstance() Creating a connection by using the SQLServerDriver class For more information, see Using the JDBC Driver. When the getConnection method of the DriverManager class is called, an appropriate driver is located from the set of registered JDBC drivers. When using the sqljdbc4.jar class library, applications do not need to explicitly register or load the driver by using the Class.forName method.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |