Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols binary
|
||||
|
||||
import java.sql.Connection
|
||||
import java.sql.Statement
|
||||
import java.sql.SQLException
|
||||
import java.sql.DriverManager
|
||||
|
||||
class RTableCreate01 public
|
||||
properties private constant
|
||||
addressDDL = String '' -
|
||||
' create table Address' -
|
||||
' (' -
|
||||
' addrID integer primary key generated by default as identity,' -
|
||||
' addrStreet varchar(50) not null,' -
|
||||
' addrCity varchar(50) not null,' -
|
||||
' addrState char(2) not null,' -
|
||||
' addrZip char(10) not null' -
|
||||
' )'
|
||||
driver = String 'org.apache.derby.jdbc.EmbeddedDriver'
|
||||
dbName = String 'db/rosetta_code'
|
||||
|
||||
method createTable() public static
|
||||
connectionURL = String
|
||||
conn = java.sql.Connection
|
||||
sqlStatement = java.sql.Statement
|
||||
do
|
||||
Class.forName(driver)
|
||||
connectionURL = 'jdbc:derby:' || dbName || ';' || 'create=true'
|
||||
conn = DriverManager.getConnection(connectionURL)
|
||||
sqlStatement = conn.createStatement()
|
||||
say 'Creating table'
|
||||
sqlStatement.execute(addressDDL)
|
||||
say 'Table creation complete'
|
||||
sqlStatement.close()
|
||||
conn.close()
|
||||
do
|
||||
-- In embedded mode, an application should shut down Derby.
|
||||
-- Shutdown throws the XJ015 exception to confirm success.
|
||||
connectionURL = 'jdbc:derby:' || ';' || 'shutdown=true'
|
||||
DriverManager.getConnection(connectionURL)
|
||||
catch sex = SQLException
|
||||
if sex.getSQLState().equals("XJ015") then do
|
||||
say 'Database shut down normally'
|
||||
end
|
||||
else do
|
||||
say 'Database did not shut down normally'
|
||||
signal sex
|
||||
end
|
||||
end
|
||||
catch sex = SQLException
|
||||
sex.printStackTrace()
|
||||
catch ex = ClassNotFoundException
|
||||
ex.printStackTrace()
|
||||
end
|
||||
return
|
||||
|
||||
method main(args = String[]) public static
|
||||
createTable()
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue