riahc3 50 Â Team Colleague

Hey

Im trying to connect to a remote MySQL server running on Windows using a Ubuntu client (via a local IP on the same network) and I receive this:

Lost connection to MySQL server at 'reading initial communication packet', system error: 110

I imagine that it is in the host configuration that doesn't allow external connections so how can I fix this?

Thanks.

riahc3 50 Â Team Colleague

Hey

Does anyone know a good tutorial to understand web services under Java using WSDL? Most are pretty confusing and at the end offer no source sample code to test it out.

Thanks

riahc3 50 Â Team Colleague

Hey

How do I mirror a entire database to another server? Federated tables arent a option in this case as I need foreign keys.

Thanks

riahc3 50 Â Team Colleague

Foreign keys are to guarantee database integrity. If you maintain only the local database and update the remote by use of federated tables, then integrity errors on the remote should not occur - except with incomplete transactions. Do federated tables support transactions?

Federated tables (as mentioned) does not allow foreign keys....

If I have the original DB with foreign keys located at server one (1) and my data base located at server two (2), I cant make all the tables federated at (1) because federated tables dont have that support.

Do you mean make federated tables at (2) and have them point at (1)? If so, Ive been told that I cant modify anything at (1) (security reasons) so this is unlikely....

riahc3 50 Â Team Colleague

Hey

Using MyEclipse 10 for Spring while developing Matisse/Swing GUI applications something very annoying happens: Whenever I change anything on the form in Design view the view always changes to Source view. (In between a progress bar with 'formatting' text appears.)

How can I this behaviour switch off?

Thanks

riahc3 50 Â Team Colleague

Can you post what you did to fix the problem so others with the same problem can see how you fixed it.

Using IE is a bad idea.......

riahc3 50 Â Team Colleague

The only reason is called "free". Nothing more, nothing less.

riahc3 50 Â Team Colleague

Hey

Im going to use some federated tables that I need but I know that the engine does not support foreign keys.

Im thinking of alternatives and this is the one so far:

Tables from the remote side and related related with a foreign key on the local side.

Its the only way I can think of to keep the relations I need. The other one would be not to relate any table at all but obviously this cant be done.

Suggestions? Thank you

riahc3 50 Â Team Colleague

Hello

How do I go on about calling from Java stored procedures (which have variables going in and out) and transactions in MySQL?

For a stored procedure example, something like 2 variables in that are numbers and the third going out that is the result.

Thanks

riahc3 50 Â Team Colleague
riahc3 50 Â Team Colleague

Oh, that looks promising. Thanks for sharing.

No problem :) And great to hear I have another recommendation on it being a good idea. Reenforces it a alot so thanks :)

riahc3 50 Â Team Colleague

It seems the solution Ive found is federated tables:

http://en.wikipedia.org/wiki/MySQL_Federated

I can excute the triggers on my local side (Server 2) as if they were Server 1.

This is as close as it can get right?

riahc3 50 Â Team Colleague

Slow down how many things? How many transactions per second do you expect? Why can't you use standard mysql replication? And as I said,

I ment slow down in development....

The situation is that there is a server in one place (our host) with Magento installed which has its own database with tables for a application we need. Our application server in Java which interacts with tables but (for some reason) we cant modify the Magento database (thats going to be on another server: thats what we have been told and recommended) to add those tables so they can all be in the same database. We've been told to have two databases: The one in Magento needed for the application on that server (which runs PHP) and the one on our server for (for example) logins and such (which runs Java: We are also told that they cant be on the same server).

My original idea was to have it all in one database but we have been told that for security reasons it is not advised so

riahc3 50 Â Team Colleague

Yes you can, but only if db1 and db2 share the same connection parameters: are on the same server and have the same user credentials (username, password).

The only thing different is as I said: Different servers.

I cant do this if they are on different servers?

If not (which would slow things down alot....), any way I can emulate it in a Java servlet at least?

riahc3 50 Â Team Colleague

I don't think there is an API or function to connect to an external database from within a stored procedure.
You could alternatively set up a complete database replication or execute the DML statements from your scripting environment by use of transactions which you rollback if one command fails.

(Considering everything is the same as the first post. and ignoring sintaxis errors.....)

I cant do something like:

create trigger x after insert on db1.t1
for each row
being
insert * from db1.t1 into db2.t1
end;

(quick and dirty example just to show what I mean)

riahc3 50 Â Team Colleague

Ive been told today that I cant run a AMP server (to interprete PHP for example) and Java servlet on the same location.

riahc3 50 Â Team Colleague

After banging my head repeateding on the keyboard, I figured out what was wrong.


And for the first time it actually wasnt my fault :P

Thanks to all :)

riahc3 50 Â Team Colleague

Your ISP might also be caching things, and perhaps the others are automatically issuing a request for fresh data. Just a possibility.

Its not my ISP as it only occurs on IE (all versions) and I am the only one requesting things.

riahc3 50 Â Team Colleague

Hello

Using MySQL, I have DB 1 with table T1 on Server 1 and DB 2 with table T1 on Server 2. Not on the same network and T1 contain the same columns with the same datatypes.

I want to create a trigger on DB 1 so when there is a insert on T1 on DB 1, all the data inserted in T1 is copied (or inserted) into T1 but the T1 that is on DB 2 on Server 2.

Thanks for the help,

riahc3 50 Â Team Colleague

OK, I will call you crazy. There is no reason to do such stuff when Java is able to handle all this. Simple example can be found here in JSP section or if you willing to learn there is number of frameworks that can help you with database management like Hibernate, with website like Wicket

PS: Post is moved to JSP section

Go ahead, call me crazy :P

No, but seriously, Im doing this in PHP as I see making a servlet for this is a overkill and simply using a PHP script I can do it alot faster and easier.

riahc3 50 Â Team Colleague

My (idea) is

Login (HTML)
PHP validates it querying a BD and returns view products
Select a product and using data from the login and product selected, passes to my Java servlet to produce a file....


Basically thats the line more or less. Dont take that word for word though...

riahc3 50 Â Team Colleague

Why does IE still cache pages even if I tell it not to using

"Cache-Control","no-cache" (Im doing this in a servlet so Im sending "no-cache" to "Cache-Control". In order words: Cache-Control=no-cache)
"cache", "no-cache"


Firefox, Chrome, Safari, my Android browser (Chrome), ALL of them dont cache the page expect IE.

Why???

riahc3 50 Â Team Colleague

Hey

How do I make Apache Tomcat allow to interpret PHP as well?

Allowing something like:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
{
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html><head><meta http-equiv='pragma' content='no-cache' /><title>Hello</title></head><body>");
out.println("<?php echo 'Hello'; ?>");
out.println("</body></html>");
out.flush();
out.close();
}

Thanks!

riahc3 50 Â Team Colleague

With ' ', stil nothing....

riahc3 50 Â Team Colleague

Still nothing...

riahc3 50 Â Team Colleague

With no ' ' ?

riahc3 50 Â Team Colleague

Can you explain what programs are being used and where those programs are executing and where the image file is located?

Currently Im making the BMP and with response writing HTML containing the link to the file....

riahc3 50 Â Team Colleague

But I cant directly link to C:/file.jpg , no matter where the HTML file is?

riahc3 50 Â Team Colleague

Ok...so where is your HTML file located? You may need to set the source of your image file to be "../../archivo1.jpg" ( or however many directories you need to move up ).

The image is on C: and the HTML file is (I believe):

C:/dir/dir/dir/dir/dir

I believe.......Ill have to confirm that.

riahc3 50 Â Team Colleague

uhm no this is not java-java is not simple text in a file, but rather compiled byte code- this that you show is Hyper Text Markup language/html, your post would be better answered here:http://www.daniweb.com/web-developme...ml-and-css/143 however i see no reason why the picture would not be shown, it is good practice in html though-also i heard-to put c:/filename and not c:\filename.

My mistake. I thought it only worked after calling a Java servlet.

It is indeed a HTML error.

riahc3 50 Â Team Colleague

Your image is displaying inside your IDE because the IDE is smart enough to know that you want to see a specific file in that specific place. My suggestion would be...

1. Create a folder to work on your web page or pages...you can call it HTML_WORK
2. Move your html file/files inside that folder
3. Create another folder inside your HTML_WORK folder called IMAGES
4. Copy or Move your image from c:\ to the IMAGES folder
5. Change your line from this ... <img src='c:\archivo1.jpg' width='500' height='500'></'> ... to this .... <img src='images/archivo1.jpg' width='500' height='500' />

That should give you what you are looking for.

The reason the browser cannot find the image is because it needs to know where to find the image based on the file that is calling it. Your IDE can see it in C:\ ....your web browser cannot.

I need to to work from C: first because this is actually from a Java servlet (complicated)> Once I get it to work there, then I can move on and implant it in my Java code.

First I need this HTML to work as is......No Java involved at all. So making a workcenter with folders is right now out of the question....

riahc3 50 Â Team Colleague

I have this code:

<html><head><title></title></head><body><form id='formulario' action='index.html' method='post'><label>Ancho </label><input type='text' name='ancho' id='ancho'><br ><label>Alto </label><input type='text' name='alto' id='alto'><br ><label>Izquierda </label><input type='text' name='izquierda'  id='izquierda'><br ><label>Horizontales </label><input type='text' name='horizontal'  id='horizontal'<br ><label>Verticales</label><input type='text' name='vertical' id='vertical'><br  ><label>Crucero </label><input type='text' name='cruzero' id='cruzero'><br ><label>Marco </label><input type='checkbox' name='marco' id='marco'><br ><label><input type='radio' name='RadioGroup1' value='1'  id='piezas'>Piezas</label><br><label><input type='radio' name='RadioGroup1'  value='0' id='medidas'>Medidas</label><br><input type='submit' value='Enviar'></p></form><img src='c:\archivo1.jpg' width='500' height='500'></body></html>

It doesnt work (doesnt show the image) if I save it as a .html file but if I try it in my Java IDE (MyEclipse) perfect...

No sense at all and its driving me nuts.

Anything?

riahc3 50 Â Team Colleague

(This has to be a Java question as it simply works in a txt with a HTML extension....)

I have this code:

<html><head><title></title></head><body>
<form id='formulario' action='index.html' method='post'>
<label>Ancho </label><input type='text' name='ancho' id='ancho'><br >
<label>Alto </label><input type='text' name='alto' id='alto'><br >
<label>Izquierda </label><input type='text' name='izquierda' 

id='izquierda'><br >
<label>Horizontales </label><input type='text' name='horizontal' 

id='horizontal'<br >
<label>Verticales</label><input type='text' name='vertical' id='vertical'><br 

>
<label>Crucero </label><input type='text' name='cruzero' id='cruzero'><br >
<label>Marco </label><input type='checkbox' name='marco' id='marco'><br >
<label><input type='radio' name='RadioGroup1' value='1' 

id='piezas'>Piezas</label><br><label><input type='radio' name='RadioGroup1' 

value='0' id='medidas'>Medidas</label><br>
<input type='submit' value='Enviar'></p>
</form><img src='c:\archivo1.jpg' width='500' height='500'></body></html>

Why does this work (displays the image) in the MyEclipse browser and not in IE/Chrome/FF/etc?

riahc3 50 Â Team Colleague

OK - run out of memory, then trying to execute a bind that has already been executed.
My best guess is that either you are in a simple infinite loop, or you are making a recursive call without a proper termination condition. I assume that would not be deliberate. Trace the execution with a few well-placed print statements.

Restarted Windows and everything is fixed (" ": New thread coming up....)

riahc3 50 Â Team Colleague

.....remove the bufferimage refrence to test something and now:

java.net.BindException: Address already in use: JVM_Bind

....what?

riahc3 50 Â Team Colleague

But other code there has nothing to do with this...

Hello is shown on the screen. Bye isnt.

The bufferimage is the problem right?

riahc3 50 Â Team Colleague

You might have ment fillRect...

Did that too and nothing.

riahc3 50 Â Team Colleague

AFAIK, set color only accepts a Color type object....

riahc3 50 Â Team Colleague

Hey

Putting this code:

System.out.println("Hello");
BufferedImage bufferedImage = new BufferedImage(620, 420, BufferedImage.TYPE_INT_RGB);
System.out.println("Bye");
		Graphics2D g2d = bufferedImage.createGraphics();
		g2d.setColor(Color.black);
		g2d.fillRect(0, 0, 620,420);  
		g2d.setColor(Color.yellow);

It throws a java.lang.OutOfMemoryError: Java heap space error not displaying the bye. I dont understand as my BufferedImage is nothing at all (simple 620 by 420).

Why is this happening?

riahc3 50 Â Team Colleague

Where is there any java programming involved in this problem?

HTML form calls itself with one of the <img> tags having a servlet, servlet response with a BMP shown in the img tags.

The java programming is the servlet.

riahc3 50 Â Team Colleague

Please explain the programs that you are using.
What is the navigator?
Why do you think the server should respond to your http request?

Basically, because I call the servlet, passing form values, and then after processing the data, it gives me a image...

Ill try to get back to you on monday.

riahc3 50 Â Team Colleague

What is the navigator program you are using?
Do you understand the difference between the http:// protocol and C:/ ?
The first requires a server.

This is why it is driving me nuts....

Im running this on a server but it only works on the local side, in its physical location.

In PHP I know why this happens but Im not sure if it is the same problem (shouldnt)

riahc3 50 Â Team Colleague

If I go to

http://localhost/somefolder/somepicture.bmp

I cant see if in my navigator.

Now

If I go to

C:/somefolder/somepicture.bmp

It works perfectly.

This is completely driving me crazy. I really have no other methods that I could try to get this to work.

Ask questions and Ill try to give answers.....
Thanks

riahc3 50 Â Team Colleague

I dont think this is too difficult as Ive done it in courses Ive done and it took tops a hour. I right now dont remember how to do it so if someone could help out....

riahc3 50 Â Team Colleague

check here maybe:http://www.exampledepot.com/egs/java.../GetImage.html

Wouldnt I have to check for something like a postback? This way when the servlet is loaded, I can load the image (which doesnt exist as it is generated by the servlet) and display it.

Although I would like to save the image on the current directory and load it from there.

riahc3 50 Â Team Colleague

Hello

Im trying to generate a image from a servlet and display it with browser.

Lets say I want to do something like this:

protected void doPost(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, java.io.IOException {  
                  BufferedImage bufferedImage = new BufferedImage(620, 420, BufferedImage.TYPE_INT_RGB);
		Graphics2D g2d = bufferedImage.createGraphics();
		g2d.setColor(Color.black);
		g2d.fillRect(0, 0, 620,420);  
		g2d.setColor(Color.yellow);
		bufferedImage.getGraphics();
}

This simply generates a box with a box rect. Ignore the yellow.....

Now obviously I have to get the response as I call the servlet again and display the image (as it physically isnt stored anywhere)

How can I do this? Or somewhere I can start at least.....

Thanks.

riahc3 50 Â Team Colleague

I officially believe I am a idiot.....

I was navigating to C: instead of http:// in my browser....

riahc3 50 Â Team Colleague

I made it and basically same thing happens: Code is shown.

PHP works as I can access phpMyAdmin perfectly. Also if I go to http://localhost/ ir redirects me to http://localhost/xampp/.Localhost by default is at C:\xampp\htdocs\ I made a folder in there with the html and php files.

riahc3 50 Â Team Colleague

My index.html is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<title></title>
</head>

<body>
<form action="index.php" method="post" name="uandp">
<input type="text" name="user"><br >
<input type="password" name="password">
<input type="submit" value="Go">
</form>
</body>
</html>

My index.php is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php session_start(); ?>

<html>
<head>
	<title></title>
</head>

<body>
<?php
print "Printeo";
echo 'Llego!';
$uservar=_$POST['user'];
echo $uservar;
?>
</body>
</html>

The when I click the button in the html in the form, it goes to the php page but displays the code. When I hit F5, it says it has to send data again to the server and doesnt show any information at all.


Problably something dumb and basic Im missing. I know it works because I put it in my htdocs folder which is by default. PHP also works.

Thanks

riahc3 50 Â Team Colleague

Um for some reason it works on MyEclipse 10