Register the drive and obtain the connection. register the drive to get it.

Source: Internet
Author: User

Register the drive and obtain the connection. register the drive to get it.

1. Three Methods for registering a drive

(1) Class. forName ("com. mysql. jdbc. Driver ");

(2) System. setProperty ("jdbc. drivers", "com. mysql. jdbc. Driver ");

(3) DriverManager. registerDrivers (new com. mysql. jdbc. Driver () is not recommended ());

3. Three methods to obtain the connection

(1) Connection conn = DriverManager. getConnection ("jdbc: mysql: // localhost: 3306/test", "root", "123456 ");

(2) Connection conn = DriverManager. getConnection ("jdbc: mysql: // localhost: 3306/test? User = root & password = 123456 ");

(3) Connection conn = DriverManager. getConnection (strUrl, props );

Database. properties configuration file

Jdbc. drivers = com. mysql. jdbc. Driver

Jdbc. url = jdbc: mysql: // localhost: 3306/test

Jdbc. user = root

Jdbc. password = 123456

...

 

Properties props = new Properties ();

FileInputStream in = new FileInputStream ("database. properties"); // obtain the database. properties configuration file

Props. load (in );

In. close ();

String strDriver = props. getProperty ("jdbc. drivers ");

String strUrl = props. getProperty ("jdbc. url ");

System. setProperty ("jdbc. drivers", strDriver );

Connection conn = DriverManager. getConnection (strUrl, props );


After connecting to the computer, you can see the disc drive letter in "My Computer" in the system, but double-click to open and read

D

How can a PLC be connected with a servo drive? Is there a wiring diagram?

It also depends on how you control the servo drive.
Use the servo driver manual to obtain the serial number and pin position of the control port. These include pulse, direction (pulse string control), analog input port (analog control), enable signal, encoder return, and alarm output.
After confirming the above port, pin and signal name, connect the above signal with the corresponding port pins of your PLC and positioning module or other modules, which is the wiring diagram you need.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.