If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > JAVA > MySql + Java // Column not found, message from server

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-21-03, 12:57
chrste chrste is offline
Registered User
 
Join Date: Mar 2003
Location: germany
Posts: 17
MySql + Java // Column not found, message from server

Hi,

i hava a problem when inserting a row in a mysql-table
from a java-program. Database and table exists !
Platform: Windows 2000.


String url = "jdbc:mysql:///javas"; // javas is the database
String sqlQuery1 = "Insert into customer values (" + name + "," + ssNo + "," + address + "," + phone +")";

System.out.println("sqlQuery : " + sqlQuery1); // shows //the sql-command correctly
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection aConnection =
DriverManager.getConnection(url, "root", "");

Statement aStatement = aConnection.createStatement();
aStatement.executeUpdate(sqlQuery1);
.....
}
catch (SQLException e)
{
while (e != null)
{
System.out.println("SQLExeption caught " +e);
e = e.getNextException();
}
}

I can compile the program, but when executing i get
the message:
Column not found, message from server:
"Unknown column 'fgg' in 'field list'"
where fgg is the attribute of the field called name and not
a field of the table !

when i use:
String sqlQuery1 = "Insert into customer values ("a","b","
c","d")" it works (but I wan't to get the field-attribute from
a formular).

Whats wrong ? Thanks for any help.

Chris
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On