how i can detect a foreign key in table mysql ? (it's very urgent ,pls!)

someone can tell me how to detect a foreign key in a table (mysql) and know which table this key point to ? i'am new with jstlit's very urgent,pl,Message was edited by: miagistevn
[209 byte] By [miagistevna] at [2007-11-27 7:55:20]
# 1
If you can show us your code we can tell you whats wrong ;)
deAppela at 2007-7-12 19:36:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

i dont have code yet ! i want just to know: if I have two tables A and B, A's primary key is B's foreign key, how i can which column of B is foreign key and which table this key point to (in this case,this key points to A,but generally, I must find A )

is there somme function like mysql_field_flags in PHP ? (which returns type/options of column)

thx bro

miagistevna at 2007-7-12 19:36:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Have you considered asking the person who designed that database?
DrClapa at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Well, it doesn't always work, but you can use metadata for a connection to find out all the primary keys.I dunno about foreign keys, you'll have to look into that, but Connection.getMetaData() seems like a good place to start.
nogoodatcodinga at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
i can't becoz the subject is to visualise any database (all i know is database name,then i get all tables by querry show tables, then visualise content of each table,if one table refer to another by FK,I donnt how to dectect FK to view refered table) any1 have Idea ?
miagistevna at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6

Did you even bother to read my reply? And if you did, did you take the pains to look up DatabaseMetaData http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html? I don't think so or you would have found getImportedKeys().

No one's going to hand you your code on a plate, and no one's gonna help you if you can't make an effort yourself.

nogoodatcodinga at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7

Did you even bother to read my reply? And if you did, did you take the pains to look up DatabaseMetaData http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html? I don't think so or you would have found getImportedKeys().

No one's going to hand you your code on a plate, and no one's gonna help you if you can't make an effort yourself.

- Afficher le texte des messages

thax for your help, but i dont know why u said so rude?my previous reply was not for you but DrClap who recommened "Have you considered asking the person who designed that database? " so on thax anyway , i followed your intructions already.

miagistevna at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
In that case, I apologize; but you hadn't acknowledged my suggestion and it seemed like you'd decided to ignore it; and it did seem like the right way to go.Once again, I'm sorry. No hard feelings? :)
nogoodatcodinga at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9

> someone can tell me how to detect a foreign key in a

> table (mysql) and know which table this key point to

as said, database metadata is the place to start.

> ? i'am new with jstl

no problem, this isn't something you should do in a JSP anyway.

> it's very urgent,pl,

>

no it's not. We don't even use mySQL, we use Oracle.

jwentinga at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10

okie, i didnot get it all, but thanks you all guy .

"no it's not. We don't even use mySQL, we use Oracle."

if you dont use,and then what do you want me to do ?Oracle is good but not anytime

PS: why this forum did not take quote on clicking "reply" ?

Message was edited by:

miagistevn

Message was edited by:

miagistevn

miagistevna at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11
> PS: why this forum did not take quote on clicking> "reply" ?> You need to click the 'Quote Original' button while replying.
nogoodatcodinga at 2007-7-12 19:36:41 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...