+ 3

how to connect java with sql server managment database system

please write as steps

24th Apr 2018, 12:52 PM
ekhlas Mohamed Abdallah Mohamed
ekhlas Mohamed Abdallah Mohamed - avatar
1 Odpowiedź
0
The first thing is that Java does not connect to the DBMS, it connects to the database like a DBMS would do it, and that is by providing the user name, password, host name, port and a service name or Service ID, that's a standard database connection set up. What you need is a driver for java to connect to the database, something like "JDBC", but there's at least one particular driver available in java for literally any database. You can import java's "sql" package, and in it you would find "Connection", "DriverManager", "ResultSet" and other useful classes. Here's Glimpse of some Java connection setup: Class.forName("oracle.jdbc.driver.OracleDriver"); //driver String connString = loadConnectionValue("oracleSIT.url");// "jdbc:oracle:thin:@//<host name>:<port>/<Service Name>"; Db2Conn = DriverManager.getConnection(connString,loadConnectionValue("oracleSIT.userName"),loadConnectionValue("oracleSIT.passWord"));
24th Apr 2018, 3:26 PM
Roberto Guisarre
Roberto Guisarre - avatar