Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 02:22 AM
Ashok......
Guest
 
Posts: n/a
Default Arjunt......

hi!
Everybody.

I have written a code to connec to postgre sql
databse.But i am geting some error.

import java.sql.*;
import java.util.*;
import java.lang.*;



public class LoginPage {
public static void main(String[] args)
{
Connection conn;
try
{

Class.forName("org.postgresql.Driver");
String url =
"jdbc:postgresql://localhost:5432/test";
conn = DriverManager.getConnection(url,
"postgres", "viwotec");


Statement s = conn.createStatement();
ResultSet r = s.executeQuery("select
oid,id,name,password from myschema.login");
while( r.next() )
{


int id = r.getInt(2);
System.out.println("Row " + id + ":");

int oid = r.getInt(2);
System.out.println("Rowoid " + oid + ":");

/*String nam = r.getString();
System.out.println("Name of the person" + nam
+ ":");

String pass = r.getString();
System.out.println("Password you entered was"
+ pass + ":"); */

}
s.close();
conn.close();
}
catch( Exception e )
{
e.printStackTrace();
}
}
}


and the error is
java.lang.ClassNotFoundException:
org.postgresql.Driver
at
java.net.URLClassLoader$1.run(URLClassLoader.java: 199)
at
java.security.AccessController.doPrivileged(Native
Method)
at
java.net.URLClassLoader.findClass(URLClassLoader.j ava:187)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:2 89)
at
sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:274)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:2 35)
at
java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at LoginPage.main(LoginPage.java:14)

please tell me solution for this...How i can load the
driver and where

--- Shachar Shemesh <shachar@lingnu.com> wrote:
[color=blue]
> pwbyrne@hotmail.com wrote:
>[color=green]
> >Hi,
> >
> >I'm looking for details, or tools about porting a[/color]
> full Ms Sql Server[color=green]
> >2000 database to Postgres on Linux.
> >
> >Is this possible? We have the whole nine yards,[/color]
> stored procedures,[color=green]
> >triggers, and all.
> >
> >Is there a way to automate this process?
> >
> >Thanks
> >
> >[/color]
> Totally automate - no.
>
> There are tools to help you along, however. They
> are not as complete as
> I would like them, and I need lots of help in
> maintaining the site. It's
> located at http://pgfoundry.org/projects/sql2pg/,
> but there are
> currently no released files. In CVS, however, you
> will find a perl
> script that translates the exported database
> description from MS SQL to
> a more-or-less PG friendly format. Also you will
> find there support for
> two data types - varcharci (case insensitive) and
> utinyint (1 byte
> unsigned integer).
>
> Any help with maintaining this project would be
> greatly appreciated.
>
> I do have a few questions for you. What drivers do
> you currently use to
> access your database? Do you use the stored
> procedure's ability to
> return more than one result?
>
> Shachar
>
> --
> Shachar Shemesh
> Lingnu Open Source Consulting ltd.
> http://www.lingnu.com/
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to
> majordomo@postgresql.org so that your
> message can get through to the mailing list
> cleanly
>[/color]




__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles