cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Sangeetha_Aswin
Level 3

running mysql command line client from batch file

Hi,

I m new to this InstallAnywhere 2009.

I have tried to run mysql command line client from a batch file.

the batch contains the following code

mysql --user=root --password=root mysql < mysql_db.sql

if i excuete this script(batch) file seperately it is launching mysql command line client and copies the sql file content to the databse.

But when i set it as Target file(Execute Target file) or paste it as a Script (Execute script/batch file)in the InstallAnywhere it is not launching the mysql client and installer is also hanging.

i want to dispaly mysql command line client in postInstall.

please correct me if im not going in a correct way.
Labels (1)
0 Kudos
(7) Replies
pv7721
Level 20

Would it be possible for you to post your project?
0 Kudos
Sangeetha_Aswin
Level 3

Thanks for ur reply

i have attched my project xml file as well as my script file.
0 Kudos
aesparza
Level 4

Hi Sangeetha,

I can tell you how I do this. I launch a batch file from my installer with the "Execute command" action and I use "C:\apoyo.bat" as my command line. In that file I have something like this
"C:\Program Files\MySQL\MySQL Server 5.0\bin\mysql.exe" -u root --password=root < "C.\apoyo.sql"

Maybe the problem you have is because you don't specify the path to the mysql executable.

Hope this helps.
Regards
Alberto E.
0 Kudos
Sangeetha_Aswin
Level 3

Hi Albert,

Thanks for your reply.

I tried by giving the sql path also.It is not working for me.

I m very much confused ,now i wrote a custom code also.

As a seperate jar it is inserting values in DB tables,

But when try to execute it in InstallAnywhere it is not working,

I have complete ths sql connection by asap

pls help me if anybody knows
0 Kudos
aesparza
Level 4

Hi again Sangeetha,

Actually, if you are trying to run a MySQL script with the Enterprise edition of IA '09, you can include a database server in the Organization -> Hosts tab. You then configure the connection data and in the Install tab you will be able of adding a new kind of action, the "Run SQL Script" where you can include your SQL script.

Can you try if this helps you?
Regards
Alberto E.
0 Kudos
umamalleswarik
Level 3

I am trying to access the mysql database from java custom code. I am getting the error as ERROR:Cannot load the database driver: com.mysql.jdbc.Driver
But the same code is working fine if I ran from Eclipse.
Any help is appreciated?

And how to get the return value from Database Server Hosts? I have passed the variables to Database Server host added as MySQL . How do I know that its successfully connected to the db.
0 Kudos
pv7721
Level 20

You need to bundled the MySQL driver along your custom code.
0 Kudos