Reputation: 27628
this is my code but it givas an error would you please help me(in mySQL I have a table that has VARCHAR name ,VARCHAR address and VARCHAR telephone and TINYINT age and BIGINT charge)
I want to insert a name and address and telephone and age with calling this method .but it will give an error for line insertARow("Adam Smit","21 First Avenue, Fairlyland, 87654","123456789",35);
ERROR:create an InsertARow method(String,String,String,Int);
the class:
insertARow("Adam Smit","21 First Avenue, Fairlyland, 87654","123456789",35);
}
private static void insertARow(String name,String address,String telephone,BigInt age) {
}
Upvotes: 2
Views: 15779
Reputation: 308001
A BIGINT
in MySQL is a 64 bit integer type, so you can simply handle it as a long
(and/or Long
) value in Java, as long as you are using the SIGNED
variant.
If you want to support an UNSIGNED BIGINT
, then you will have to handle the values as java.math.BigInteger
in Java.
Since you don't show any code that actually interfaces with the Database (JDBC) I can't tell you what you're doing wrong.
Upvotes: 5
Reputation: 54695
Your code is attempting to use BigInt as a Java type, which will not compile. As Joachim mentions you need to use a long
or Long
in Java.
Upvotes: 0