In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Package com.ist.common.util;import java.sql.*;import javax.naming.Context;import javax.naming.InitialContext;import javax.naming.NamingException;public class JdbcOracleTest {/ / orcl is the database name in the oracle database, and localhost indicates that the connection to the local oracle database / / 1521 is the connection port number private static String url= "jdbc:oracle:thin:@192.168.99.98:1521:orcl" / / system is the user name of private static String user= "nms09" logged in to the Oracle database; / / manager is the password of user name system "nms09"; public static Connection conn; public static PreparedStatement ps; public static ResultSet rs; public static Statement st / / method public void getConnection () {try {/ / initialize driver package Class.forName ("oracle.jdbc.driver.OracleDriver"); / / assign conn=DriverManager.getConnection (url, user, password) to conn according to database connection character, name, password } catch (Exception e) {/ / TODO: handle exception e.printStackTrace ();}} / / Test whether you can successfully connect to the oracle database public static void main (String [] args) {JdbcOracleTest basedao=new JdbcOracleTest (); basedao.getConnection () If (conn==null) {System.out.println ("connection to oracle database failed!") ;} else {System.out.println ("connected to oracle database successfully!") ;}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.