Java:208:error:cannot find symbol

4 posts / 0 new
Last post
Offline
Last seen: 4 days 18 hours ago
Joined: 05/15/2019
Posts: 8
Java:208:error:cannot find symbol

I'm currently faced with this problem. Can anyone advise on how to solve this problem?

** I'm working on the RTI JAVA (Hello_world) with mySQL database.

Offline
Last seen: 1 week 2 days ago
Joined: 08/20/2012
Posts: 15

The examples as shipped don't contain this line, so I am assuming that you are modifying the example to make use of MySQL. I suspect you need to call the prepareStatement() method on the Connection object. However, I wanted to make sure you are aware that RTI offers an off-the-shelf Database Integration Service with bidirectional integration; samples received can be stored in tables, and data inserted into tables can be published in Topics.

Regards,
Tom

Offline
Last seen: 4 days 18 hours ago
Joined: 05/15/2019
Posts: 8

Yes I'm modifying the example with the help of MySQL. I have inserted the following into my program and the result is as shown in the pic(above). Not sure if the code below is the correct way to write it. (I'm using Visual Studio Code to write the Java example program of "Hello_World").

Class.forName("com.mysql.jdbc.Driver");
System.out.print("Connecting to database");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/database", "userid", "pass");
Statement st = conn.createStatement();
 
try {
String sql = "INSERT INTO anexample(ID,Temp) VALUES (?,?)";
PreparedStatement ps = Connection.PreparedStatement(sql);
ps.setInt(1, id);
ps.setFloat(2, temp);
ps.executeUpdate();
}
catch (SQLException e) {
System.out.println(e.getMessage());
}
Offline
Last seen: 1 week 2 days ago
Joined: 08/20/2012
Posts: 15

I hoped you might try my previous suggestion on the syntax: PreparedStatement(sql) --> prepareStatement(sql). Also, have you looked at Database Integration Service and concluded it doesn't suit your use case?