Back to Browse

85 Advanced Java Tutorial | Type 5 JDBC Driver | Java Database Connectivity | adv java

869 views
Sep 24, 2017
23:28

#Advanced java JDBC Tutorial | adv java:Java Database Connectivity | How to work with JDBC Type 5 Driver : Step To Develop Java Application Using Type 5 JDBC Driver: Step 1: Go to http://www.datadirect.com/products/jdbc/index.html click on Download Driver. https://www.progress.com/trial-datadirect Register your details, and u will get the email attachment, regarding the downloads Download the Windows or Java installer from the location provided by Progress DataDirect: • Windows: PROGRESS_DATADIRECT_CONNECT_JDBC_5.1.4_WIN.zip • Non-Windows: PROGRESS_DATADIRECT_CONNECT_JDBC_5.1.4.jar Step 2: Once you have downloaded you will get PROGRESS_DATADIRECT_CONNECT_JDBC_5.1.1_WIN.jar Step 3: Extract that jar and you will get a setup file. Click on this setup file then the Driver will be install in your machine. Step 4: Now gather Oracle.jar file from the default location C:\Program Files\Progress\DataDirect\Connect_for_JDBC_51\lib Step 5: Now simply add this jar (Oracle.jar) in the classpath. By doing this we have set the environment for using Type 5 JDBC driver. Step 6) Create Java JDBC Application using JDBC Type 5 driver import java.sql.*; public class Type5Test { public static void main(String[] args) throws Exception { // Register the driver with the driver manager. // If using Java SE 6, you can omit this step. // Java SE 6 automatically registers the driver. //I am Using JDK 8 so Commented below statement/line //Class.forName("com.ddtek.jdbc.oracle.OracleDriver"); // Establish the Connection String url="jdbc:datadirect:oracle://localhost:1521;ServiceName=orcl"; Connection con=DriverManager.getConnection(url,"scott","boss"); System.out.println("Connection is : " + con); //send & execute the query Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from student"); while (rs.next()) { System.out.println(rs.getInt(1)+"\t"+rs.getString(2)+"\t"+ rs.getString(3)); } DatabaseMetaData metaData = con.getMetaData(); System.out.println("Database Name: " +metaData.getDatabaseProductName()); System.out.println("DB Version:"+ metaData.getDatabaseProductVersion()); rs.close(); st.close(); con.close(); } }

Download

0 formats

No download links available.

85 Advanced Java Tutorial | Type 5 JDBC Driver | Java Database Connectivity | adv java | NatokHD