aspose file tools*
The moose likes JDBC and the fly likes Problems with creating table in mysql through JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problems with creating table in mysql through JSP" Watch "Problems with creating table in mysql through JSP" New topic
Author

Problems with creating table in mysql through JSP

hso xu
Greenhorn

Joined: Dec 27, 2005
Posts: 2
Hi i am trying to create a table in mysql database through jsp.
i am using jsp to upload the *.sql files into my server, and at the same time i want the mysql to import the *.sql. Unfortunately in order for my to open the sql file i need to use the commend \. *.sql but when i use this command in jsp, i get an error:
illegal escape character
updateDatabase= "\. "+fileName+"";
^
wat should i do?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The back slash is an escape character in Java.
You will need to escape that:

String sqlcommand = "\\. filename.sql";


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
hso xu
Greenhorn

Joined: Dec 27, 2005
Posts: 2
ok i get this error now
java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\. addresses.sql' at line 1
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I'm not a mySql guru but I believe the backslash commands are particular to the mysql command line interface. I don't think they can be called like the rest of the SQL commands via JDBC.

This topic might do better in the JDBC forum.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60053
    
  65

Moved to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems with creating table in mysql through JSP
 
Similar Threads
java.sql.*
Trigger runs on some column time reached...
Meta Data for Oracle Store Procedures?
MqSQL to Oracle
connecting JSP(resin) to MYSQL with out root