Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
H2 database connection
Old 02-24-2010, 10:49 PM H2 database connection
Junior Talker

Posts: 1
Trades: 0
Hello,

I am having some trouble connecting to my H2 database - below is the
block of code I wrote to establish the connection:

Class.forName("org.h2.Driver").newInstance();
Server server = Server.createTcpServer().start();
Connection conn = DriverManager.getConnection("jdbc:h2:tcp://
localhost/schedules", "sa", "");

The Driver class, JDBC URL, User Name and Password I used in the code
above is exactly the same to what I'm using to connect to my database
in the H2 login page. The URL of my database login page is http://localhost:8082.
8082 is the port I'm using that's tunneled via SSH to my actual
database that's hosted in a separate server. When I tried to query the
database by executing

Statement stmt = conn.createStatement();
rs = stmt.executeQuery("select * from Schedules");

I got the following error in the console:
org.h2.jdbc.JdbcSQLException: Table "Schedules" not found; SQL
statement:
select * from Schedules [42102-126]

When I changed the table name to one that doesn't even exist in my
database I got the same error message. Does anyone know what I've done
wrong? Your help would be tremendously appreciated!

Cheers,
Liz
liz99 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-26-2010, 12:44 PM Re: H2 database connection
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
request data from a table that DOES exist.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to H2 database connection
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22486 seconds with 12 queries