In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Package cn.com.login.dao;import java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;public class LoginDao {public String getUserName (String userCode) {Connection con = null; PreparedStatement pre = null; ResultSet result = null; String userName = ""; try {Class.forName ("oracle.jdbc.driver.OracleDriver") / / load the Oracle driver System.out.println ("start trying to connect to the database!") ; String url = "jdbc:oracle:" + "thin:@10.10.19.19:1521:db123"; String user = "system"; String password = "scc123456"; con = DriverManager.getConnection (url, user, password); System.out.println ("connected successfully") String sql = "select userName from web01_test where userCode =?"; pre = con.prepareStatement (sql); pre.setString (1, userCode); result = pre.executeQuery () While (result.next ()) {userName = result.getString ("userName");} catch (Exception e) {e.printStackTrace () } finally {try {if (result! = null) {result.close ();} if (pre! = null) {pre.close () } if (con! = null) {con.close () } catch (Exception e2) {e2.printStackTrace ();}} return userName;}}
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.