开发者

Calling MySQL database using Java

开发者 https://www.devze.com 2023-01-20 11:03 出处:网络
Hi I am new to programming and trying to call a table from a MySQL database using Java.Here is what my Java code looks like:

Hi I am new to programming and trying to call a table from a MySQL database using Java. Here is what my Java code looks like:

public static void main(String[] args){ 
        double p1[] = {10000000,2,5,7,5,6,6,8,9,3};
        double p2[] = {100,3,4,3,4,1,2,5,1,5};
        double p3[] = {1,2,6,4,5,6,7,8,9,1};
        Expert_Score x = new Expert_Score(a, p1);
        Expert_Score y = new Expert_Score(b, p2);
        Expert_Score z = new Expert_Score(c, p3);
        Z_score scrCalc = new Z_score();
        scrCalc.Z_Calc(x,y,z);
        scrCalc.print();
}
}

I want to be able to call开发者_开发问答 from MySQL: a, b, c, p1, p2 and p3. a,b and c represent Customer ID's. P1, P2, and P3 represent a string of ten numbers from a table associated with those Customer Id's. I also want to deposit the output of this code back into a new table in MySQL. Thanks in advance.


You will have to learn how to do JDBC (Java DataBase Connectivity) with MySQL. Download MySQL Connector/J (MySQL Connector for Java) and follow an article such as this which shows you a step-by-step approach on setting up MySQL and how to play with MySQL in java.

Hope this helps.


You need to use the JDBC (Java Database Connectivity) API plus the appropriate JDBC driver for MySQL.

Here's a page with the JDBC driver links plus tutorials etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号