db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen <Oystein.Grov...@Sun.COM>
Subject Re: Newbie Blues : Unable to connect to derby database using JDBC
Date Fri, 16 Nov 2007 05:16:39 GMT
Aneez,

Can you provide the call stack for the exception you get?

--
Øystein


Aneez Backer wrote:
> Hi
> 
> Am trying to connect to derby database, but have not been successful.
> 
> I have created a database called 24k , and have also populated the tables
> 
> Here's the code:
> 
> ---------------------------------
> 
> org.apache.derby.jdbc.EmbeddedSimpleDataSource ds = null;
>             Connection conn = null;
>             Properties props = new Properties();
>             props.put("user", username);
>             props.put("", "");
>     
>            Class.forName(driver).newInstance();
>             System.out.println("Loaded the appropriate driver.");
>        
>             conn = DriverManager.getConnection(protocol +"24k;", props);
>             System.out.println("Connected to database 24k");
> 
>             conn.setAutoCommit(false);
> 
>             Statement s = conn.createStatement();
> 
>             ResultSet rs = s.executeQuery("SELECT firstname, lastname 
> FROM USERS WHERE uid = 1001");
> 
> ---------------------------------------------------------------
> 
> 
> ---------------------------------------------------------------
>     ERROR
> ---------------------------------------------------------------
> 
> 
> 
> 
> Loaded the appropriate driver.
> Connected to database  24k
> exception thrown:
> java.sql.SQLDataException: Invalid character string format for type int.
> 
> ---------------------------------------------------------------
> 
> Please guide
> 
> Thanks
> Aneez
> 
> 
> 
> 
> ------------------------------------------------------------------------
> Get easy, one-click access to your favorites. Make Yahoo! your homepage. 
> <http://us.rd.yahoo.com/evt=51443/*http://www.yahoo.com/r/hs>


Mime
View raw message