• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQLException

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm using java5, mySql 4.1 and my driver is mysql-connector-java-3.0.16-ga-bin.jar
i'm using eclipse 3.2 too
after testing my Jdbc class and get a green, i tried to test it from another computer that is in my home network
from mysql admin i granted everything to user root from my son's ip: 192.168.1.102

here's my code:
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


when i run the jar from my son's pc, i get an SQLException i also tried to run, from dos:telnet pai 3306 but cant connect...(pai is my computer's name) what am i doing wrong? TiA


Please post the stack trace.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

C:\>java -jar X.jar
a come�ar...
Exception in thread "main" java.sql.SQLException: com.mysql.jdbc.Driver
at bd.JdbcAccess.getConnection(JdbcAccess.java:35)
at bd.Filhos.main(Filhos.java:23)

 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i just opened por 3306 from windows firewall and now telnet prints something, but when running the jar things are the same...
btw, i jared everything, driver included
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is all your stack trace tells you? java.sql.SQLExceptions always come with at least some sort of reason.
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
that's all i get!
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i uncomment this line:
i get:

C:\>java -jar X.jar
a come�ar...
Exception in thread "main" java.lang.NullPointerException
at bd.Filhos.main(Filhos.java:37)

 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just in case, i also did:

mysql> grant all privileges on *.* to root@192.168.1.102
-> ;
Query OK, 0 rows affected (0.00 sec)

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


i tried to test it from another computer that is in my home network
from mysql admin i granted everything to user root from my son's ip: 192.168.1.102

String url = "jdbc:mysql://pai/" + nomeBaseDados + "?user=root@192.168.1.102&password=xxx";

(pai is my computer's name)



is pai running the mySql? if so, try the ip address.

add the port 3306

String url = "jdbc:mysql://pai:3306/" + nomeBaseDados + "?user=root@192.168.1.102&password=xxx";

maybe even try passing the connection params

[ August 17, 2006: Message edited by: graham king ]
 
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the sugestion
i tried that and a variety of other possible combinations

somehow i've the felling that, from my son's pc, connection is never established

mi idea is that i have my url wrong...

at this moment i have it like this:
String url = "jdbc:mysql://192.168.1.101/" + nomeBaseDados + "?user=root&password=abc";
and if i run the class from my pc(where mySql is), it prints ok:

a come�ar...
inside try block
inside finally block 1
inside finally block 2

but from my son's, not at all

dont know what to do
[ August 17, 2006: Message edited by: miguel lisboa ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic