Bob Thompson

Greenhorn
+ Follow
since Jul 30, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bob Thompson

I'll have to take a look at that but wont be able to right now. Last day of classes are tomarrow then finals week so i may be pretty busy, its not for a class so there's really no hurry. I'm sure i'll have questions later though, thx for the link
I've had an ongoing thread about making an administrator application in java that will be able to display update and delete table data. My question is:

Where would i find how to make this same line in java:

code:
--------------------------------------------------------------------------------

$result = mysql_query($sql, $dbase) or die(mysql_error());

--------------------------------------------------------------------------------


thats from a php file i made. It also has:

code:
--------------------------------------------------------------------------------

$dbase = "riverview";@$sql = "SELECT * FROM riverview WHERE month = ".$month." AND year=".$year;

--------------------------------------------------------------------------------


then there's an array in a while statement that fetches all of the data from the field specefied:

code:
--------------------------------------------------------------------------------

while ($TEMPArray[$tempi] = mysql_fetch_array($result)){ $tempi=$tempi+1; }

--------------------------------------------------------------------------------



So what i'm trying to do it get into an existing table, fetch everything on that table thats in the specified field, then display it somehow.


My old threads here if you wanted to see anything else we went through.

http://www.coderanch.com/t/341155/GUI/java/Visibility-help
roger that capn
12 years ago
Where would i find how to make this same line in java:

thats from a php file i made. It also has:

then there's an array in a while statement that fetches all of the data from the field specefied:


So what i'm trying to do it get into an existing table, fetch everything on that table thats in the specified field, then display it somehow.
12 years ago
Interesting, i removed the 8080 and got this:

MySQL Driver found
Connection OK
Found record 1 first entry
Found record 2 second entry
Found record 3 third entry

Now my quetion is, it seems your program is supposed to create a table? The DB is still empty after running it. At least the connection works though, now i can actually work with it

Ok i can be slapped for that last question, i overlooked the executeUpdate(con,"drop table test"); line. if i comment that the table stays. I think i can try what i wanted now
[ August 03, 2005: Message edited by: Bob Thompson ]
12 years ago
I'm usnig port 8080, i did change it to 8080 and still had the message. i'll try downloading the files you specefied
12 years ago
Yes, but i did change the username and pass to the one i always use for my php work. It has all access for everything.
12 years ago
I'm running easyPHP on my comp. works fine for everything as a testing db. I've mainly been using it for php.
12 years ago
Ok so this is beging weird. I had installed the drivers the same plave you did and tried running your code. at firstit said driver found then it said Oops, no connection then while editing like 4 minutes later a bunch of stuff came up

MySQL Driver found
OOPs - No Connection
java.sql.SQLException: Communication link failure: java.io.EOFException, underlying cause: null

** BEGIN NESTED EXCEPTION **

java.io.EOFException

STACKTRACE:

java.io.EOFException
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1395)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1414)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1808)
at com.mysql.jdbc.Connection.<init>(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MySQL_Test.getConnection(MySQLTest.java:28)
at MySQL_Test.<init>(MySQLTest.java:6)
at MySQL_Test.main(MySQLTest.java:70)


** END NESTED EXCEPTION **


at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1447)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1808)
at com.mysql.jdbc.Connection.<init>(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at MySQL_Test.getConnection(MySQLTest.java:28)
at MySQL_Test.<init>(MySQLTest.java:6)
at MySQL_Test.main(MySQLTest.java:70)

I also tried using the driver registering as you did within the codei have and its still saying "unsuitable driver"
12 years ago
I cant take it anymore, i want to smash my computer . I tried those links and installed the driver form the first one but that didnt work. I changed the driver in the program too and when ran it said "unsuitable driver".

My roomate claims that to use sun.jdbc.odbc.JdbcOdbcDriver you shouldnt have to install anything new, i should already have it. any idea's?
12 years ago
well i tried that tutorial and it didnt work, i still think its this driver thing. i get this error with their code exacly

SQL Exception: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Exception in thread "main" java.lang.NullPointerException
at dbWrapper.Select(dbWrapper.java:57)
at DBTest.main(DBTest.java:13)

do i have to download/install something?

i should have probably mentioned i'm using mySQL with phpadmin
[ August 01, 2005: Message edited by: Bob Thompson ]
12 years ago
Guess i should refresh before replying

I tried suns tutorial but i couldnt make head or tails of it. Said something about having to load a driver and when i used the line they supplied it didnt work.
[ August 01, 2005: Message edited by: Bob Thompson ]
12 years ago
AWSOME! You've been alot of help, now just to figure out the SQL

Do you know any good sites/coding examples to figure out how to use SQL in java? plz dont say sun, i can never find anything on their site

[ August 01, 2005: Message edited by: Bob Thompson ]
[ August 01, 2005: Message edited by: Bob Thompson ]
12 years ago
Well i figured out some logic and a way to do the different panels using the other action listener way you showed. I think i got the gui pretty much done, tomarrow i just have to learn how to do SQL in java.

Still one last question, i would rather not use the radio buttons and use JButtons but as of right now i only have 5 buttons and their height is equally spread until it reaches the bottom. How could i define a height or make the layout not go all the way to the bottom?

Here's what i have now if you dont understand what i'm saying:

12 years ago
Ok this is making my brain bleed i think

The way you have the sample program set up it makes 3 panels that when the cooresponding button is pressed will come into view. I made a String Array thathas the name of each button i want to add and instead of having panel x+1 i have buttonArray[x] which works fine. The problem i'm having is i need each button to do something different and i cant really figure out how. I tried making the actionPerformed mas i did before and using:

if(ae.equals("CustID"){
//The code i want executed
}else if(ae.equals("First Name"){
//The code i want executed
}else//so on and so forth

but this doesnt work, and it seems i'm just making myself try the same thing i was having problems with before. So the question now is, what can i do to make it so each button has different events? I also tried putting the same statements within the actionPerformed lines you already had but that still didnt work. Could you show me a little something within that program you posted before that would be able to make each button do something else. Or explain how i could make it do this if it should already and i'm just not seeing it. Not trying to leach free code, i just learn alot better looking at a the source of a working program.
12 years ago