Table of contents
0. Preliminary preparation (version is not limited)
Notice:
-- Reference Connector/ JDownload https://dev.mysql.com/downloads/connector/j/
Connector/ODBC download https://dev.mysql.com/downloads/connector/odbc/
Java SE Development Kit 8 Downloads ( including JRE) download 32-bit version https://www.oracle.com/cn/java/technologies/javase/javase-jdk8-downloads.html
MySQL configuration ODBC data source |
0. Preliminary preparation (version is not limited)
0.1 Download and install the 32-bit JDK: jdk-8u271-windows-i586.exe
After installing:
0.2 Download and install 32-bit connector/J: mysql-connector-java-8.0.22.jar
After installing:
1. Right-click to run as an administrator, and set the Java environment of PB (non-administrators will report errors)
1.1 Java Tab - Add Path - Select File
1.2 Select the installed Connector/J
1.3 Set JDK , navigate to Jdk and Jre respectively
1.4 Confirm and restart the PowerBuilder software after completion;
Open the system option again, if it changes to Loaded as shown below, the version can be the version installed by yourself;
2. Connect to the database (assuming MySQL has been installed and the database student has been created, and the database server is running)
2.1 Click Database
2.2 Connection tab:
Notice:
Profile Name: Fill in whatever you like
Driver Name: com.mysql.jdbc.Driver ( different versions here may be different)
URL: jdbc:mysql://localhost:3306/student?serverTimezone=Asia/Shanghai
Login ID: database user ID
Password: database user password
URL format: jdbc:mysql://<IP>:<Port>/<database>?serverTimezone=<suitable time zone (error will be reported by default)>[&other parameters]
Among them, <> is required, [ ] is optional
It is best for the database user to be an account with only one database permission, because PowerBuilder will display all operable tables under this account, which is easy to confuse;
2.3 System tab: the database used must be filled in, otherwise warning ⚠
2.4 Preview tab: The connection test is successful
2.5 You can see the table after connecting
3. Error resolution
If the configuration is complete, after a period of time, it will display an error: Could not initialize JavaVM.
It is possible that your JDK has been updated automatically. At this time, reconfigure step 1.3 to solve the problem.
Complete the connection (the ODBC connection method is quite different and cannot be used for reference)
Personal experience, please correct me if there are any mistakes or omissions;
Welcome to like and collect~
Copyright©2021 Cherry_ChenNan